本文整理汇总了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;
}
}