G
Guest
Hi,
I want to do a very simple thing that I use to do it in C++.
I have an instance of a class and I have a function that returns a copy of
that instance (a new object).
Because a class is a reference type in .NET if I say retun MyInstance
actually returns a reference to my original instance. In this scenario I want
to pass a copy of it.
IFoo MyInstanceOfFoo = new Foo();
IFoo GetAuction(int id)
{
return MyInstaceOfFoo; // This returns the instance
}
Now, do I have a quick way of returning a copy? (Without me creating a new
foo and copy every single property?)
Regards
I want to do a very simple thing that I use to do it in C++.
I have an instance of a class and I have a function that returns a copy of
that instance (a new object).
Because a class is a reference type in .NET if I say retun MyInstance
actually returns a reference to my original instance. In this scenario I want
to pass a copy of it.
IFoo MyInstanceOfFoo = new Foo();
IFoo GetAuction(int id)
{
return MyInstaceOfFoo; // This returns the instance
}
Now, do I have a quick way of returning a copy? (Without me creating a new
foo and copy every single property?)
Regards