public class LookupItem { public virtual string Descrip { get; set; } public int ID { get; set; } public static string ListToJson(List<LookupItem> items) { var result = new List<string>(); foreach (var item in items) result.Add(item.ID.ToString() + ":" + item.Descrip); return string.Join(";", result.ToArray()); } }
public static class LookupManager { public static List<LookupItem> Nullify(this List<LookupItem> result, string nullValue) { if (nullValue != null) result.Insert(0, new LookupItem { Descrip = nullValue, ID = -1 }); return result; } }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.