C# TypeInfo IsNested
Description
TypeInfo IsNested
Gets a value indicating whether the
current Type object represents a type whose definition is nested inside
the definition of another type.
Syntax
TypeInfo.IsNested
has the following syntax.
public bool IsNested { get; }
Example
The following code example displays the value of the IsNested property for both a protected nested class and a public nested class.
using System;//w ww . j ava2s .co m
public class Example
{
protected class NestedProtected
{
}
public class NestedPublic
{
}
public static void Main()
{
Type t = typeof(NestedProtected);
Console.WriteLine("Is {0} nested? {1}", t.FullName, t.IsNested);
t = typeof(NestedPublic);
Console.WriteLine("Is {0} nested? {1}", t.FullName, t.IsNested);
}
}
The code above generates the following result.