Read only two-dimensional array in C#
问题 Is there any established way of returning a read-only 2-d array in C#? I know ReadOnlyCollection is the right thing to use for a 1-d array, and am happy to write my own wrapper class that implements a this[] {get} . But I don't want to reinvent the wheel if this wheel already exists. 回答1: There's only one way to simulate this. You need to create your own class, with a private array. The most similar implementation of an array is an indexer: Using indexers Indexers (C# programming guide) 10.8