What is the purpose of hidebysig in a MSIL method?

前端 未结 3 1221
独厮守ぢ
独厮守ぢ 2020-12-07 11:06

Using ildasm and a C# program e.g.

static void Main(string[] args)
{

}

gives:

.method private hidebysig static void  Main(         


        
3条回答
  •  天涯浪人
    2020-12-07 11:29

    According to Microsoft Docs

    When a member in a derived class is declared with the C# new modifier or the Visual Basic Shadows modifier, it can hide a member of the same name in the base class. C# hides base class members by signature. That is, if the base class member has multiple overloads, the only one that is hidden is the one that has the identical signature. By contrast, Visual Basic hides all the base class overloads. Thus, IsHideBySig returns false on a member declared with the Visual Basic Shadows modifier, and true on a member declared with the C# new modifier.

提交回复
热议问题