Export (0) Print
Expand All

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.

Caution noteCaution

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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft