Gets a value indicating whether only a member of the same kind with exactly the same signature is hidden in the derived class.
Assembly: mscorlib (in mscorlib.dll)
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,returns false on a member declared with the Visual Basic Shadows modifier, and true on a member declared with the C# new modifier.
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 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, theproperty 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.
Available since 8
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1