public static MongoDataDictionary <T> ToDirectionary(MongoReturnDataList <T> list, string keyName) { MongoDataDictionary <T> ret = new MongoDataDictionary <T>(); if (list == null) { return(null); } for (int i = 0; i < list.Count; i++) { DetailStringClass obj = list[i] as DetailStringClass; string key = obj.getValue(keyName)?.ToString(); MongoReturnDataList <T> sublist = new MongoReturnDataList <T>(); if (!ret.ContainsKey(key)) { ret.Add(key, sublist); } sublist = ret[key]; sublist.Add(list[i]); ret[key] = sublist; } return(ret); }
object IConvertible.ToType(Type conversionType, IFormatProvider provider) { return(DetailStringClass.GetObjectByXml(this.ToXml(), conversionType)); }