C# TypeInfo IsVisible

Description

TypeInfo IsVisible Gets a value indicating whether the Type can be accessed by code outside the assembly.

Syntax

TypeInfo.IsVisible has the following syntax.


public bool IsVisible { get; }

Example

The following code example tests two classes, only one of which is visible outside the assembly.


/*from   ww w. j  a  v  a2s .c o  m*/
using System;

internal class InternalOnly 
{
    public class Nested {}
}

public class Example
{
    public class Nested {}

    public static void Main()
    {
        Type t = typeof(InternalOnly.Nested);
        Console.WriteLine(
            "Is the {0} class visible outside the assembly? {1}", 
            t.FullName, 
            t.IsVisible
        );
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo