ReadonlyHashset.cs 442 B

123456789101112131415
  1. using System.Collections.Generic;
  2. namespace VCommon.Collections
  3. {
  4. public class ReadOnlyHashSet<T>
  5. {
  6. private readonly HashSet<T> _underlying;
  7. public ReadOnlyHashSet(HashSet<T> underlying) => _underlying = underlying;
  8. public bool Contains(T value) => _underlying.Contains(value);
  9. public static implicit operator ReadOnlyHashSet<T>(HashSet<T> instance) => new ReadOnlyHashSet<T>(instance);
  10. }
  11. }