I'm attempting to write a generic method based on the following myMethod:
void myMethod(myClassA instanceA, myClassB instanceB)
{
instanceA = new myClassA(instanceB);
}
What I've got so far is something like this (myMethod_new), which has some errors:
void myMethod_new<S, T>(S instanceA, T instanceB) where S : new()
{
instanceA = new S(instanceB);
}
However, since I've not mastered how generics work in C#, how should this be implemented?