Answers for "c# get type without namespace"

C#
3

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
Posted by: Guest on December-15-2020
0

c# Get type with namespace

using System.Reflection;
private Type[] GetTypesInNamespace(Assembly assembly, string nameSpace)
{
    return 
      assembly.GetTypes()
              .Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal))
              .ToArray();
}
Posted by: Guest on December-15-2020

C# Answers by Framework

Browse Popular Code Answers by Language