N
not_a_commie
I was wondering if it was possible to copy a type such that you don't
actually change the reference of the object you're copying into. I
understand that you would usually use the ref keyword for this
situation, but my (legacy) code is in such a situation that this is
impossible.
The unworking function that I need to make work:
void changeType(Type b){
b = Type.GetType(myType); // changed ref on b
}
what I want:
void changeType(Type b){
b.ChangeTo(myType);
}
I have the same situation elsewhere with strings. I need a string
function like "ChangeTo" that just changes the pointer to the string
table without changing the reference like the "=" operator does.
actually change the reference of the object you're copying into. I
understand that you would usually use the ref keyword for this
situation, but my (legacy) code is in such a situation that this is
impossible.
The unworking function that I need to make work:
void changeType(Type b){
b = Type.GetType(myType); // changed ref on b
}
what I want:
void changeType(Type b){
b.ChangeTo(myType);
}
I have the same situation elsewhere with strings. I need a string
function like "ChangeTo" that just changes the pointer to the string
table without changing the reference like the "=" operator does.