/// <summary>
        /// Wraps the given set making it read-only.
        /// </summary>
        /// <typeparam name="T">The type of the items in the set.</typeparam>
        /// <param name="set">The set to make read-only.</param>
        /// <returns>A new read-only set wrapping the given set.</returns>
        /// <exception cref="System.ArgumentNullException">The set is null.</exception>
        public static ReadOnlySet <T> ReadOnly <T>(this ISet <T> set)
        {
            ReadOnlySet <T> readOnly = set as ReadOnlySet <T>;

            if (readOnly == null)
            {
                return(new ReadOnlySet <T>(set));
            }
            return(readOnly);
        }
示例#2
0
 public ReadOnlySetDebugView(ReadOnlySet <T> set)
 {
     _set = set;
 }