In the .net CLR Object is the base for all class objects, but not basic types (e.g. int, float etc). How can I use basic types like Object? I.e. Like Boost.Variant?
E.g. like :-
object intValue( int(27) );
if (intValue is Int32)
...
object varArray[3];
varArray[0] = float(3.141593);
varArray[1] = int(-1005);
varArray[2] = string("String");
object
, via boxing, is the effective (root) base-class of all .NET types. That should work fine - you just need to use is
or GetType()
to check the types...
object[] varArray = new object[3];
varArray[0] = 3.141593F;
varArray[1] = -1005;
varArray[2] = "String";