dotnet / dotnet/dotnet-api-docs
Multidimensional arrays in ArrayList?
- 主要言語
- C#
- スター
- 950
- フォーク
- 1.7k
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 52
説明
The documentation says: "Using multidimensional arrays as elements in an ArrayList collection is not supported." What exactly does this mean? The following code:
var arrayList = new System.Collections.ArrayList();
var item = new int[2, 2] { { 1, 2 }, { 3, 4 } };
arrayList.Add(item);
... normally adds the array to the list. The parameter of ArrayList.Add(value) is object, so it supports adding any object to the list; specifically disallowing multidimensional arrays would seem like an arbitrary limitation. (The elements of the inner array can be retrieved by casting the element, like this: ((int[,])arrayList[0])[1,0] .)
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 9fa6e8e6-c711-8423-a1b9-3ad1e51484ad
* Version Independent ID: 7400ed93-312d-9193-5eb4-512551cb66d9
* Content: [ArrayList Class (System.Collections)](https://docs.microsoft.com/en-us/dotnet/api/system.collections.arraylist?redirectedfrom=MSDN&view=netframework-4.7.2#methods)
* Content Source: [xml/System.Collections/ArrayList.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Collections/ArrayList.xml)
* Product: **dotnet-api**
* GitHub Login: @mairaw
* Microsoft Alias: **mairaw**
コントリビューションガイド
調査の方向性
xml/System.Collections/ArrayList.xml と、issue にリンクされている ArrayList Class のドキュメントから始めます。多次元配列に関する記述を、提示された C# の例と照らし合わせて確認し、動作を正確に説明するよう文言を更新します。完了の条件は、ドキュメントが ArrayList.Add(object) の実例で示された使用方法と矛盾しなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100