dotnet / dotnet/dotnet-api-docs
Multidimensional arrays in ArrayList?
- Vorherrschende Sprache
- C#
- Sterne
- 949
- Forks
- 1.7k
- Ø Merge
- 2 T. 19 Std.
- Gemergte PRs (30 T.)
- 52
Beschreibung
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**
Beitragsleitfaden
Rechercherichtung
Beginne mit xml/System.Collections/ArrayList.xml und der im Issue verlinkten Dokumentation zur ArrayList Class. Überprüfe die Aussage zu mehrdimensionalen Arrays anhand des bereitgestellten C#-Beispiels und aktualisiere die Formulierung so, dass sie das Verhalten korrekt erklärt; als erledigt gilt, dass die Dokumentation nicht mehr im Widerspruch zur gezeigten Verwendung von ArrayList.Add(object) steht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100