Overloading null ambiguity

后端 未结 2 1601
[愿得一人]
[愿得一人] 2020-12-20 17:21

I have the following methods:

  void Method(string param1, string param2);
  void Method(string param1, object param2);

When I call the met

2条回答
  •  醉话见心
    2020-12-20 17:45

    You can be specific about which version of the method you want to call by specifying which type of null you're passing:

    Method("string", null as string);
    

提交回复
热议问题