I have a situation where I get a reference to an object that I would like to "overwrite" with another object of the same type. I know by design that the objects are of the same type. I do not have access to the parent object in this function.
The dataobject is defines as like:
Class DataObject
{
public List<int> Stuff = new List<int>();
}
Then there is a method
void DoStuff(object obj)
{
// At this point I know that obj is List<int>
// Create new object from some source
var newList = new List<int>();
// Here I would like to make the passed object the new object
(the pointer of obj) = (the pointer of newlist)
}
I don't know if this is possible. It's just something I've been banging my head against for a couple of hours now and my brain seems to have stopped working.
Thanks in advance
Johan