Assignment to struct array inside method does not work in C#?
问题 Here is the code snippet from my LinqPad: public class Elephant{ public int Size; public Elephant() { Size = 1; } } public struct Ant{ public int Size; } private T[] Transform2AnotherType<T>(Elephant[] elephantList) where T:new() { dynamic tArray = new T[elephantList.Length]; for (int i = 0; i < elephantList.Length; i++) { tArray[i] = new T(); tArray[i].Size = 100; //tArray[i].Dump(); } return tArray; } void Main() { var elephantList = new Elephant[2]; var elephant1 = new Elephant(); var