public PropertyListItem clone() { PropertyListItem result = new PropertyListItem(); result.assign(this); return(result); }
public void assign(PropertyListItem value) { this.name = value.name; this.displayName = value.displayName; this.category = value.category; this.value.assign(value.value); this.defaultValue.assign(value.defaultValue); }
/// <summary>不存在则自动增加</summary> public PropertyListItem getItem(string name) { int insertPos = 0; int index = getItemIndex(name, ref insertPos); if (index >= 0) { return(items[index]); } PropertyListItem item = new PropertyListItem(); item.name = name; items.Insert(insertPos, item); return(item); }
/// <summary>不存在则自动增加</summary> public PropertyListItem getItem(string name) { for (int i = 0; i < items.Count; i++) { if (items[i].name.Equals(name)) { return(items[i]); } } PropertyListItem item = new PropertyListItem(); item.name = name; items.Add(item); return(item); }
/// <summary>增加一个新的属性,如果属性存在则更新,不存在则新建</summary> public void addProperty(PropertyListItem item) { PropertyListItem current = getItem(item.name); current.assign(item); }