Imagine something like this...
public class Result
{
public string Name {get; set;}
public int Score {get; set;}
public bool Pass {get; set;}
}
And a static method...
public static Result SetPass(this Result result)
{
result.Pass = result.Score > 50;
return result;
}
My question is do I have to return the result or is it already modified in place? Could I make the return type void and then iterate through a collection of results and amend in place like this...
foreach (var result in results)
{
result.SetPass();
}
or do I need to return the result object and re-assign?