get type of variable csharp
Code Example - get type of variable csharp
string a = "This is a string";
Console.WriteLine(a.GetType())
csharp get type of class
Type tp = value.GetType();
csharp GetType
public static Type GetType(string typeName)
{
var type = Type.GetType(typeName);
if (type != null) return type;
foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
{
type = a.GetType(typeName);
if (type != null)
return type;
}
return null;
}