This documentation is archived and is not being maintained.

FieldInfo.IsFamilyAndAssembly Property

Gets a value indicating whether this field has FamilyAndAssembly level visibility.

[Visual Basic]
Public ReadOnly Property IsFamilyAndAssembly As Boolean
public bool IsFamilyAndAssembly {get;}
public: __property bool get_IsFamilyAndAssembly();
public function get IsFamilyAndAssembly() : Boolean;

Property Value

true if the field has the FamANDAssem attribute set; otherwise, false.


If a field has FamilyAndAssembly level visibility, it can be called from any member in a derived class that is also in the same assembly, but not from any other type.

The IsFamilyAndAssembly property is set when the FieldAttributes.FamANDAssem attribute is set.


[Visual Basic, C#, C++] The following example creates a class and displays the class name, field name, and IsFamilyAndAssembly property value of the field.

[Visual Basic] 
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class Fieldinfo_IsFamilyAndAssembly
    Protected Friend myField As String = "A protected internal field"

    Public Shared Sub Main()
        Dim myObject As New Fieldinfo_IsFamilyAndAssembly()
        ' Get the Type and FieldInfo.
        Dim myType1 As Type = GetType(Fieldinfo_IsFamilyAndAssembly)
        Dim myFieldInfo As FieldInfo = myType1.GetField("myField", BindingFlags.NonPublic Or BindingFlags.Instance)
        ' Display the class and field name and the FamilyAndAssembly property value for the field.
        Console.Write(ControlChars.Lf & " Name of class: {0}", myType1.FullName)
        Console.Write(ControlChars.Lf & " Value of field: {0}", myFieldInfo.GetValue(myObject))
        Console.Write(ControlChars.Lf & " IsFamilyAndAssembly: {0}", myFieldInfo.IsFamilyAndAssembly)
    End Sub 'Main
End Class 'Fieldinfo_IsFamilyAndAssembly

using System;
using System.Reflection;

public class Fieldinfo_IsFamilyAndAssembly
    protected internal string myField = "A protected internal field";
    public static void Main()
        Fieldinfo_IsFamilyAndAssembly myObject = new 

        // Get the Type and FieldInfo.
        Type myType1 = typeof(Fieldinfo_IsFamilyAndAssembly);
        FieldInfo myFieldInfo = myType1.GetField("myField",

        // Display the class and field name and the FamilyAndAssembly property value for the field.
        Console.Write("\n Name of class: {0}", myType1.FullName);
        Console.Write("\n Value of field: {0}", myFieldInfo.GetValue(myObject));
        Console.Write("\n IsFamilyAndAssembly: {0}", 
            myFieldInfo.IsFamilyAndAssembly );

#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;

public __gc class Fieldinfo_IsFamilyAndAssembly
public protected:
   String* myField;
      myField = S"A protected internal field";

int main()
   Fieldinfo_IsFamilyAndAssembly* myObject = new Fieldinfo_IsFamilyAndAssembly();

   // Get the Type and FieldInfo.
   Type* myType1 = __typeof(Fieldinfo_IsFamilyAndAssembly);
   FieldInfo* myFieldInfo = myType1->GetField(S"myField",

   // Display the class and field name and the FamilyAndAssembly property value for the field.
   Console::Write(S"\n Name of class: {0}", myType1->FullName);
   Console::Write(S"\n Value of field: {0}", myFieldInfo->GetValue(myObject));
   Console::Write(S"\n IsFamilyAndAssembly: {0}", __box(myFieldInfo->IsFamilyAndAssembly));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

FieldInfo Class | FieldInfo Members | System.Reflection Namespace | FieldAttributes