How to create extension methods for Types

前端 未结 4 1815
名媛妹妹
名媛妹妹 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 11:52

    You can't create extension methods that apply to the type itself. They can only be called on instances of a type.

提交回复
热议问题