Consider the following C# class:
public class Person
{
public string Name {get;set}
public int Age {get;set}
}
I will only be using this for passing along a couple variables in a function with a single parameter – would using a struct be a better approach?
Edit: I dont care if the values change, they are not supposed to change anyway.
It depends on your expectation of what should happen after you pass in the values.
If you don’t care about the changes in the values being retained after the function call finishes, you could make it a struct, but if you want the function which takes a person argument to make changes and the caller should see it, use a class .
Also, if this is part of a domain model / data layer I’d stick with a class.