I am programming a game using C #, so my performance is very worried.
I would like to know what are the main differences and, if possible, performance considerations when using either a class to pass data or a structure passed by reference.
I want to not copy the data for performance reasons (suppose the ref transfer is much faster than the value here).
I know that a class is always passed by reference and that struct is passed by value, but I'm talking about passing a structure by reference here.
Example data that I want to transfer:
public delegate void PathCompleteDelegate(List<PathFinderNode> path); public struct PathFinderJob{ public PathCompleteDelegate callback; public Vector3 start, end; public PathSize unitSize; public BoxCollider boxCollider; }
In the previous example, the use of the class will change? If so, what's the difference? Will the class be faster than the structure in this example? Why?
Thanks. Joao Carlos
source share