What is a method group in C#?

前端 未结 5 2000
夕颜
夕颜 2020-11-22 01:46

I have often encountered an error such as \"cannot convert from \'method group\' to \'string\'\" in cases like:

var list = new List();
// ...          


        
5条回答
  •  礼貌的吻别
    2020-11-22 02:14

    The first result in your MSDN search said:

    The method group identifies the one method to invoke or the set of overloaded methods from which to choose a specific method to invoke

    my understanding is that basically because when you just write someInteger.ToString, it may refer to:

    Int32.ToString(IFormatProvider) 
    

    or it can refer to:

    Int32.ToString()
    

    so it is called a method group.

提交回复
热议问题