Forced a Reference Type to be passed by value (or .Clone()d on Pass)
I have a math class (Vector3) that represents the 3 axis (x-y-z) with 3 floats. I would like it to be forced passed as value, not reference, since it's really ju开发者_StackOverflow中文版st... A value, not an object. Any way of doing that automatically? I know I can do .Clone() in each of my methods, but you understand this isn't optimal.
No, you can't do that automatically, because class
es are reference types by definition. You have to use a struct
if that's what you want.
精彩评论