本文整理汇总了C#中System.Reflection.MethodBase.IsFamilyAndAssembly属性的典型用法代码示例。如果您正苦于以下问题:C# MethodBase.IsFamilyAndAssembly属性的具体用法?C# MethodBase.IsFamilyAndAssembly怎么用?C# MethodBase.IsFamilyAndAssembly使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。
在下文中一共展示了MethodBase.IsFamilyAndAssembly属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: m_public
//引入命名空间
using System;
using System.Reflection;
public class Example
{
public void m_public() {}
internal void m_internal() {}
protected void m_protected() {}
protected internal void m_protected_public() {}
public static void Main()
{
Console.WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly");
Console.WriteLine("{0,-21}{1,-18}{2,-18}{3}\n",
"", "IsPublic", "IsFamily", "IsFamilyAndAssembly");
foreach (MethodBase m in typeof(Example).GetMethods(
BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
{
if (m.Name.Substring(0, 1) == "m")
{
Console.WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}",
m.Name,
m.IsPublic,
m.IsAssembly,
m.IsFamily,
m.IsFamilyOrAssembly,
m.IsFamilyAndAssembly
);
}
}
}
}
输出:
IsAssembly IsFamilyOrAssembly IsPublic IsFamily IsFamilyAndAssembly m_public True False False False False m_internal False True False False False m_protected False False True False False m_protected_public False False False True False