MethodBase.IsHideBySig Property

 

Gets a value indicating whether only a member of the same kind with exactly the same signature is hidden in the derived class.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

abstract IsHideBySig : bool with get
override IsHideBySig : bool with get

Property Value

Type: System.Boolean

true if the member is hidden by signature; otherwise, false.

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.

System_CAPS_warningWarning

This property does not determine whether a method has the NewSlot attribute. A method that is declared with either the new or the Shadows modifier will have the NewSlot attribute, but only methods declared with new (that is, only C# methods) will have the IsHideBySig property set to true. To determine whether a method has the NewSlot attribute, use code similar to the following: if ((myMethodInfo.Attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot) in C# or If (myMethodInfo.Attributes And MethodAttributes.VtableLayoutMask) = MethodAttributes.NewSlot in Visual Basic. Note, however, that although all methods declared with new or Shadows have the NewSlot attribute, not all methods that have the NewSlot attribute are declared with new or Shadows.

The following code example contains a base class with an overloaded method, and a derived class that hides one of the overloads. In the Visual Basic version of the code example, the IsHideBySig property returns false for the member in the derived class. In the C# version of the code sample, the property returns true for the member in the derived class.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: