How to create extension methods for Types

前端 未结 4 1806
名媛妹妹
名媛妹妹 2020-12-20 11:13

I am writing an extension method for parsing JSON string for any given type. I wanted to use the method on types instead of instances like many examples we already know, but

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 12:05

    The short answer is it cannot be done; extension methods need to work on an instance of something.

提交回复
热议问题