G
Guest
My code is this:
void WriteOut(object ob)
{
Type pTy = ob.GetType();
if(pTy.BaseType is System.ValueType)
.....
I get this error:
The given expression is never of the provided ('System.ValueType') type
Maybe I am thinking about this wrong. I want to pass generic "objects" into this function and use reflection to display all the properties and their values.
Now my function works fine for "objects" like my custom Person or Customer object. But if I pass an Integer into the function I want to realize that it is of System.ValueType and just print the value....
It works fine if I say: If(pTy.BaseType.ToString() == "System.ValueType")
Why is this? If the BaseType.ToString() = "System.ValueType" then shouldn't the BaseType be of System.ValueType?
I hope all that made sence. Any insight would be appreciated.
void WriteOut(object ob)
{
Type pTy = ob.GetType();
if(pTy.BaseType is System.ValueType)
.....
I get this error:
The given expression is never of the provided ('System.ValueType') type
Maybe I am thinking about this wrong. I want to pass generic "objects" into this function and use reflection to display all the properties and their values.
Now my function works fine for "objects" like my custom Person or Customer object. But if I pass an Integer into the function I want to realize that it is of System.ValueType and just print the value....
It works fine if I say: If(pTy.BaseType.ToString() == "System.ValueType")
Why is this? If the BaseType.ToString() = "System.ValueType" then shouldn't the BaseType be of System.ValueType?
I hope all that made sence. Any insight would be appreciated.