Ich habe Class
mit Eigenschaften von String
und List<String>
. Ich möchte dies List<Class>
in eine Dictionary<String, List<String>>
konvertieren, aber ich konnte dies nicht tun. Wie List<Class>
direkt an einen Dictionary?
Wie konvertiert man die Liste <Class> in Dictionary <string, Liste <String>> in C#?
public class SerializationClass
{
string key;
List<string> values;
public SerializationClass()
{
}
public string Key
{
get
{
return this.key;
}
set
{
this.key = value;
}
}
public List<string> Values
{
get
{
return this.values;
}
set
{
this.values = value;
}
}
public SerializationClass(string _key, List<string> _values)
{
this.Key = _key;
this.Values = _values;
}
}
Und die Bevölkerung der Liste zu konvertieren ist,
List<SerializationClass> tempCollection = new List<SerializationClass>();
Hier habe ich die tempCollection
zu Dictionary
Dictionary<string, List<string>> tempDict = new Dictionary<string, List<string>>(tempCollection.Count);
tempCollection zu konvertieren konvertieren möchten muss in tempDict konvertiert werden?
Schätzen Sie Ihre Antworten.
Dank und Grüße,
Amal Raj. Rufen Sie
Was man alles versucht? .. –