/// <summary> /// Add the given type to the schema look up table. If there is an error, it /// adds the error and returns false. otherwise, it adds the type to the lookuptable /// and returns true /// </summary> public AddErrorKind TryAdd(T type) { DebugCheck.NotNull(type); if (String.IsNullOrEmpty(type.Identity)) { return(AddErrorKind.MissingNameError); } var key = KeyFromElement(type); T element; if (KeyToType.TryGetValue(key, out element)) { return(AddErrorKind.DuplicateNameError); } KeyToType.Add(key, type); _keysInDefOrder.Add(key); return(AddErrorKind.Succeeded); }
/// <summary> /// Add the given type to the schema look up table. If there is an error, it /// adds the error and returns false. otherwise, it adds the type to the lookuptable /// and returns true /// </summary> public AddErrorKind TryAdd(T type) { Debug.Assert(type != null, "type parameter is null"); if (String.IsNullOrEmpty(type.Identity)) { return(AddErrorKind.MissingNameError); } string key = KeyFromElement(type); T element; if (KeyToType.TryGetValue(key, out element)) { return(AddErrorKind.DuplicateNameError); } KeyToType.Add(key, type); _keysInDefOrder.Add(key); return(AddErrorKind.Succeeded); }