/// <summary> /// Creates a persisted set. /// </summary> /// <typeparam name="T">The type of elements stored in the set.</typeparam> /// <param name="id">The identifier to use for the set.</param> /// <returns>A new persisted set instance.</returns> /// <exception cref="ArgumentNullException"><paramref name="id"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException">A persisted object with identifier <paramref name="id"/> already exists.</exception> public IPersistedSet <T> CreateSet <T>(string id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var set = new UnsortedSet(this); _items.Add(id, set); return(CreateSetCore <T>(id, set)); }
/// <summary> /// Creates a statically typed wrapper around the specified <paramref name="set"/>. /// </summary> /// <typeparam name="T">The type of the elements stored in the set.</typeparam> /// <param name="id">The identifier of the set.</param> /// <param name="set">The storage entity representing the set.</param> /// <returns>A statically typed wrapper around the specified <paramref name="set"/>.</returns> private static IPersistedSet <T> CreateSetCore <T>(string id, UnsortedSet set) => set.Create <T>(id);
public static IDictionary Create(UnsortedSet dict) { return(Create((int)dict)); }