Retrieves whether this is an abstract method.
[Visual Basic] Public ReadOnly Property IsAbstract As Boolean [C#] public bool IsAbstract {get;} [C++] public: __property bool get_IsAbstract(); [JScript] public function get IsAbstract() : Boolean;
Read-only. true if the method is abstract; otherwise false.
An abstract member is used on a base class and has no implementation supplied.
To get the MethodBase, first get the type. From the type, get the method. From the method, get the Methodbase. If the method base is other than a public method, it is protected and cannot be readily accessed. To access a non public method, in the GetMethod method, set the BindingFlags to NonPublic.
[C#]
class methodbase { public static int Main(string[] args) { Console.WriteLine ("\nReflection.MethodBase"); //Get the MethodBase of two methods. //Get the types Type MyType1 = Type.GetType("System.Runtime.Serialization.Formatter"); Type MyType2 = Type.GetType("System.Reflection.MethodBase"); //Get and display the methods MethodBase Mymethodbase1 = MyType1.GetMethod("WriteInt32",BindingFlags.NonPublic); MethodBase Mymethodbase2 = MyType2.GetMethod("GetCurrentMethod", BindingFlags.NonPublic); Console.Write("\nMymethodbase = " + Mymethodbase1); if (Mymethodbase1.IsAbstract) Console.Write ("\nMymethodbase is an abstract method"); else Console.Write ("\nMymethodbase is not an abstract method"); Console.Write("\n\nMymethodbase = " + Mymethodbase2); if (Mymethodbase2.IsAbstract) Console.Write ("\nMymethodbase is an abstract method"); else Console.Write ("\nMymethodbase is not an abstract method"); return 0; } } Produces the following output Reflection.MethodBase Mymethodbase = Void WriteInt32 (Int32, System.String) Mymethodbase is an abstract method Mymethodbase = System.Reflection.MethodBase GetCurrentMethod () Mymethodbase is not an abstract method
MethodBase Class | MethodBase Members | System.Reflection Namespace | Boolean | BindingFlags