C# Type IsVisible
Description
Type IsVisible
gets a value indicating whether the Type
can be accessed by code outside the assembly.
Syntax
Type.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 www .j av a2 s . co 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
);
t = typeof(Example.Nested);
Console.WriteLine(
"Is the {0} class visible outside the assembly? {1}",
t.FullName,
t.IsVisible
);
}
}
The code above generates the following result.