I have this data which can be very big in size, this could be an xmlstring, dataset, datatable, datarowcollection. This data will be passed to generic method together with its type.
void GenericMethod(object data, Type t)
{
var d = Convert.ChangeType(data, t);
//some tasks to do
}
Question: if data is 1GB, will ChangeType creates another object with 1GB also?
I just want to be sure, because of the memory usage.
Convert.ChangeTypecalls the instance’sIConvertibleimplementation, which is free to do whatever it wants to.If the passed object does not implement
IConvertible, an exception is thrown.