public void SetStringField(string name, string val) { if (fields.ContainsKey(name)) { // implement own exception types! throw new Exception("field does alread exist!"); } else { fields[name] = new HtspType<string>(val); } }
public void SetMessageField(string name, Message val) { if (fields.ContainsKey(name)) { // implement own exception types! throw new Exception("field does alread exist!"); } else if (this == val) { // implement own exception types! // this gets really ugly, because of all the recursive function calls throw new Exception("Message must not cotain itself!"); } else { fields[name] = new HtspType<Message>(val); } }