C# MethodInfo IsHideBySig
Description
MethodInfo IsHideBySig
Gets a value indicating whether
only a member of the same kind with exactly the same signature is hidden in
the derived class.
Syntax
MethodInfo.IsHideBySig
has the following syntax.
public bool IsHideBySig { get; }
Example
using System;/* w w w .j a va 2s . c o m*/
using System.Reflection;
public class B
{
public virtual void M()
{
Console.WriteLine("B's M()");
}
public virtual void M(int x)
{
Console.WriteLine("B's M({0})", x);
}
}
public class D:B
{
new public void M(int i)
{
Console.WriteLine("D's M({0})", i);
}
}
public class Test
{
public static void Main()
{
D dinst = new D();
Type t = dinst.GetType();
foreach( MethodInfo minfo in t.GetMethods() )
{
if (minfo.Name=="M") {
Console.WriteLine(minfo.IsHideBySig);
Console.WriteLine(minfo.DeclaringType);
}
}
}
}
The code above generates the following result.