C# TypeInfo Namespace

Description

TypeInfo Namespace Gets the namespace of the Type.

Syntax

TypeInfo.Namespace has the following syntax.


public abstract string Namespace { get; }

Example

Gets the namespace of the Type.


using System;//www  .j av  a2  s. c o m

namespace MyNamespace
{
    class MyClass
    {
    }
}

public class Example
{
    public static void Main()
    {
         Type myType = typeof(MyNamespace.MyClass);
         Console.WriteLine("Displaying information about {0}:", myType); 
         Console.WriteLine("   Namespace: {0}.", myType.Namespace);
         Console.WriteLine("   Module: {0}.", myType.Module);
         Console.WriteLine("   Fully qualified name: {0}.", myType.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo