ERLEDIGT
NEIN
NEIN
ANTWORTEN
2
2
ZUGRIFFE
7966
7966
EMPFEHLEN
-
04.09.07 23:18 #1
Hallo,
ich benötige eine Klasse (Collection/Dictionary) in C# womit es möglich ist, mehrere Werte einem Key zuzuordnen. Es wäre auch okay, wenn ich als Value einen string hätte, und diesen dann einfach mehrere Werte anhängen könnte.
Solch eine Klasse müsste man wohl selbst machen, oder hat da noch jemand eine bessere Idee für mich?
Gruß
-
versuchs mal mit
Code :1
System.Collections.Hashtable dic = new System.Collections.Hashtable();
oder mit
Code :1
System.Collections.Generic.Dictionary<TKey, TValue> dic = new System.Collections.Generic.Dictionary<TKey, TValue>();
mfg meikiGeändert von Meiki_ (05.09.07 um 08:41 Uhr)
-
Hi
Ich würde dir ein generic Dictionary empfehlen, da typstabil.
Als Value nutzt du eine Generic-List (List<>), mit den Datentyp, den du benötigst.
Als zum Beispiel:
Damit hast du einen string als Key und kannst als Wert beliebig viel string hinzufügen (ist natürlich auch mit anderen Datentypen möglich)Code csharp:1
Dictionary<string, List<string>> nennMichWieDuWillst = new Dictionary<string, List<string>>();
Grüße Nico
----------------------
Xing
----------------------
Zitat von Mark Twain (1835-1910)
Zitat von Mike Wilson - Biographie über Larry Ellison (CEO Oracle)
Ähnliche Themen
-
String zusammenstellen anhand von mehreren Strings mit Positionslängen
Von Aleyna23 im Forum Java GrundlagenAntworten: 2Letzter Beitrag: 20.07.10, 13:36 -
JPA NamedQuery => where in collection?
Von The_S im Forum Enterprise Java (JEE, J2EE, Spring & Co.)Antworten: 10Letzter Beitrag: 04.01.09, 13:44 -
Struct mit Strings - Alle Strings auf einmal "leeren"
Von C4rter im Forum C/C++Antworten: 2Letzter Beitrag: 17.05.08, 10:40 -
New Collection
Von Ellinar im Forum 3D-StillsAntworten: 11Letzter Beitrag: 27.03.07, 18:31 -
Collection Class
Von kerian im Forum C/C++Antworten: 9Letzter Beitrag: 20.09.05, 13:04





Zitieren

Login





