示例#1
0
 private void ReadDictionaryList(IDictionary<string, object> dictlist) {
     foreach (var i in dictlist) {
         var item = new ListItem();
         if (i.Value is IDictionary<string, object>) {
             item.Read(i.Value);
             if (string.IsNullOrWhiteSpace(item.Id)) {
                 item.Id = i.Key;
             }
             else if (item.Id == "_empty_" || item.Id == "''" || item.Id == "null" || item.Id == "\"\"") {
                 item.Id = "";
             }
         }
         else {
             item.Id = i.Key;
             item.Name = i.Value.ToStr();
         }
         List.Add(item);
     }
 }
示例#2
0
 private void ReadStringList(string strlist) {
     var dict = listreader.Parse(strlist);
     foreach (var p in dict) {
         var i = new ListItem();
         i.Id = p.Key;
         i.Name = p.Value;
         if (string.IsNullOrWhiteSpace(i.Name)) {
             i.Name = i.Id;
         }
         else if (i.Name == "_empty_" || i.Name == "''" || i.Name == "null" || i.Name == "\"\"") {
             i.Name = "";
         }
         List.Add(i);
     }
 }