GetType().IsClass returns true when variable is string

  • Thread starter Thread starter zequion1
  • Start date Start date
Z

zequion1

Guest
I'm doing a function that determines whether a variable type is a class, an enumeration or a system.type

When I ask for a type of variable of type string returns IsClass = true
Why? What is the correct way to determine when a type of variable is a class?

string MyVariable = "1";
System.Type MyType = MyVariable.GetType();
bool IsClass = MyType.IsClass; // Returns true

Continue reading...
 
Back
Top