public void Save(object obj) { if (obj.GetType() != datatype) { throw new InvalidCastException( String.Format("Expected object of type {0} recieved {1}", datatype, obj.GetType()) ); } Dictionary <String, Object> dict = ConvertToDictionary(obj); string whereobj = String.Format("{0}=\'{1}\'", "UID", datatype.GetField("UID").GetValue(obj).ToString()); Core2.Update(Name, dict, whereobj); }