I am programming a game using C#, thus, I am very concerned about performance.
I would like to know what are the main differences, and if possible, performance considerations of using either a Class to pass data around, or a struct passed by reference.
I wish not to copy the data around, for performance reasons (I assume passing by ref is much faster than by value here).
I know that a class is always passed by reference and that a struct is passed by value, but I talking about passing the struct by reference here.
An example of the data I wish to pass :
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, would using a class make a difference? If so, what would the difference be? Would a class be faster than a struct in this example? Why?
Thank you. Joao Carlos