本文整理匯總了C#中System.Reflection.MethodBase.IsAbstract屬性的典型用法代碼示例。如果您正苦於以下問題:C# MethodBase.IsAbstract屬性的具體用法?C# MethodBase.IsAbstract怎麽用?C# MethodBase.IsAbstract使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。
在下文中一共展示了MethodBase.IsAbstract屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.Reflection;
// using System.Windows.Forms;
class methodbase
{
public static int Main(string[] args)
{
Console.WriteLine ("\nReflection.MethodBase");
// 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|BindingFlags.Instance);
MethodBase Mymethodbase2 =
MyType2.GetMethod("GetCurrentMethod", BindingFlags.Public|BindingFlags.Static);
Console.Write("\nMymethodbase = " + Mymethodbase1.ToString());
if (Mymethodbase1.IsAbstract)
Console.Write ("\nMymethodbase is an abstract method.");
else
Console.Write ("\nMymethodbase is not an abstract method.");
Console.Write("\n\nMymethodbase = " + Mymethodbase2.ToString());
if (Mymethodbase2.IsAbstract)
Console.Write ("\nMymethodbase is an abstract method.");
else
Console.Write ("\nMymethodbase is not an abstract method.");
return 0;
}
}