G
Guest
I need to be able to dynamically create a new copy of a value type without
knowing the type at compile time. i.e. I need to be able to write a method
such as:
ValueType MyMethod(ValueType data)
{
return copy-of-data;
}
which returns a new ValueType that is a copy of the 'data' parameter.
Returning the 'data' parameter itself is no good as it returns the boxed
value which is passed into the method, and therefore references the original
variable.
I would have thought that there would be a simple way to do this, but I
can't think of it.
Can anyone give me an idea how to do this?
Robert.
knowing the type at compile time. i.e. I need to be able to write a method
such as:
ValueType MyMethod(ValueType data)
{
return copy-of-data;
}
which returns a new ValueType that is a copy of the 'data' parameter.
Returning the 'data' parameter itself is no good as it returns the boxed
value which is passed into the method, and therefore references the original
variable.
I would have thought that there would be a simple way to do this, but I
can't think of it.
Can anyone give me an idea how to do this?
Robert.