C# Type Namespace
Description
Type Namespace
gets the namespace of the Type.
Syntax
Type.Namespace
has the following syntax.
public abstract string Namespace { get; }
Example
This following example demonstrates a use of the Namespace and Module properties and the ToString method of Type.
using System;//from w w w .j a v a 2 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);
}
}
The code above generates the following result.