c# get class name in use code example
Example 1: c# get class name by type
typeof(T).Name // class name, no namespace
typeof(T).FullName // namespace and class name
typeof(T).Namespace // namespace, no class name
Example 2: c# get class name as string
// in c# 6.0 you can use nameof(ClassName)
// in older versions you may use typeof(ClassName).Name
// example:
public static class ClassName
{
public static void PrintName => Console.WriteLine(nameof(ClassName));
}