[Solved] why delegate work as ref? [closed]
You can change the method like that: public class Util { public static T[] Transform<T>(T[] values, Transformer<T> t) { return values.Select(x => t(x)).ToArray(); } } Then you can call it like var result = Utils.Transform(values, Square); If you can’t change that method, then you need to copy the array before calling: var result = values.ToArray(); … Read more