Mega Code Archive

 
Categories / C# / Reflection
 

FieldInfo IsAssembly Property indicates whether the field is visible at most to other types in the same assembly

using System; using System.Reflection; public class Example {     public int f_public;     internal int f_internal;     protected int f_protected;     protected internal int f_protected_public;     public static void Main()     {         foreach (FieldInfo f in typeof(Example).GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))         {             Console.WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}",                  f.Name,                 f.IsPublic,                 f.IsAssembly,                 f.IsFamily,                 f.IsFamilyOrAssembly,                 f.IsFamilyAndAssembly             );         }     } }