C# FieldInfo IsFamilyAndAssembly
Description
FieldInfo IsFamilyAndAssembly
Gets a value indicating
whether the visibility of this field is described by FieldAttributes.FamANDAssem;
that is, the field can be accessed from derived classes, but only if they are
in the same assembly.
Syntax
FieldInfo.IsFamilyAndAssembly
has the following syntax.
public bool IsFamilyAndAssembly { get; }
Example
using System;//from w w w .ja v a 2s. co m
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(f.Name);
Console.WriteLine(f.IsFamilyAndAssembly);
}
}
}
The code above generates the following result.