Tanoda
ReadonlyHashSet.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using System.Collections.Generic;
10
11namespace Leap.Unity {
12 using Query;
13
19 public struct ReadonlyHashSet<T> {
20 private readonly HashSet<T> _set;
21
22 public ReadonlyHashSet(HashSet<T> set) {
23 _set = set;
24 }
25
26 public int Count {
27 get {
28 return _set.Count;
29 }
30 }
31
32 public HashSet<T>.Enumerator GetEnumerator() {
33 return _set.GetEnumerator();
34 }
35
36 public bool Contains(T obj) {
37 return _set.Contains(obj);
38 }
39
40 public Query<T> Query() {
41 return _set.Query();
42 }
43
44 public static implicit operator ReadonlyHashSet<T>(HashSet<T> set) {
45 return new ReadonlyHashSet<T>(set);
46 }
47
48 public static implicit operator ReadonlyHashSet<T>(SerializableHashSet<T> set) {
49 return (HashSet<T>)set;
50 }
51 }
52}
A Query object is a type of immutable ordered collection of elements that can be used to perform usef...
Definition: Query.cs:90
A simple wrapper around HashSet to provide readonly access. Useful when you want to return a HashSet ...
ReadonlyHashSet(HashSet< T > set)
HashSet< T >.Enumerator GetEnumerator()