How can I create an ArrayList with a starting index of 1 (instead of 0)

后端 未结 8 649
春和景丽
春和景丽 2021-01-04 09:47

How can I start the index in an ArrayList at 1 instead of 0? Is there a way to do that directly in code?

(Note that I am asking for ArrayList

8条回答
  •  臣服心动
    2021-01-04 10:27

    As the other answers suggest, there are ways to simulate this, but no direct way to do this in C# or other commonly used .NET languages. Quoting Eric Gunnerson:

    The CLR does support this kind of construct (I had a hard time not using the term "travesty" here...), but there aren't, to my knowledge, any languages that have built-in syntax to do that.

提交回复
热议问题