This post shows you How to retrieve the namespace to a string in C#
For Example:
public partial class MyForm : Form
{
}
To get full include namespace and form name you can write
string fullName = this.GetType.FullName;
c# get namespace
string nameSpace = this.GetType().Namespace;
c# get form name
string formName = this.GetType().Name;
or you can use the Type class
Type type = typeof(MyForm);
string nameSpace = type.GetType().Namespace;
Since C# 6.0 you can use nameof keyword
string name = nameof(MyNamespace);