开发者

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 classes are reference types by definition. You have to use a struct if that's what you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜