public static void SetDataNamePropertyName(String dataNamePropertyName, ICollection dataContentCollection) { for (IEnumerator i = dataContentCollection.GetEnumerator(); i.MoveNext();) { DataContent dataContent = (DataContent)i.Current; dataContent.SetDataNamePropertyName(dataNamePropertyName); } }
// public String dump(){ // return dump(false); // } // public String dump() // { // String c = GetType().getName(); // int x = c.lastIndexOf('.'); // StringBuffer sb = new StringBuffer(); // if (x > 0) // { // sb.append(c.substring(x + 1)); // // } // else // { // sb.append(c); // } // // // sb.append("["); // bool first = true; // for (Iterator i = dataMap.entrySet().iterator(); i.hasNext(); ) // { // Map.Entry e = (Map.Entry) i.next(); // if (first) // { // first = false; // } // else // { // sb.append(","); // } // sb.append(e.getKey()); // sb.append("="); // sb.append(Utils.dump(e.getValue())); // } // sb.append("]"); // return sb.ToString(); // } public void AddAllDeclaredProperties(DataContent other) { if (other == null) { } DataInfo _info = Info(); DataField[] fields = _info.GetFields(); for (int i = 0; i < fields.Length; i++) { String n = fields[i].GetFieldName(); if (other.ContainsProperty(n)) { SetProperty(n, other.GetProperty(n)); } } }
public override bool Equals(Object o) { if (o.GetType().IsSubclassOf(GetType())) { int s = dataMap.Count; DataContent d = (DataContent)o; if (d.Size() != s) { return(false); } for (IDictionaryEnumerator i = dataMap.GetEnumerator(); i.MoveNext();) { String k = (String)i.Key; Object v = i.Value; Object v2 = d.dataMap[k]; if (v2 != null) { // field exists in Other if (!v2.Equals(v)) { return(false); } } else { if (v == null) { // either field does not exist or is null if (!d.dataMap.ContainsKey(k)) { // field doest not exist return(false); } } else { // v2 is null but v is not return(false); } } } return(true); } return(false); }