Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ReadOnlySet.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Text;
7 using System.Threading.Tasks;
8 
9 namespace SiliconStudio.Core.Collections
10 {
11  /// <summary>
12  /// Represents a strongly-typed, read-only set of element.
13  /// </summary>
14  /// <typeparam name="T">The type of the elements.</typeparam>
15  public class ReadOnlySet<T> : IReadOnlySet<T>
16  {
17  private readonly ISet<T> innerSet;
18 
19  public ReadOnlySet(ISet<T> innerSet)
20  {
21  this.innerSet = innerSet;
22  }
23 
24  public bool Contains(T item)
25  {
26  return innerSet.Contains(item);
27  }
28 
29  public int Count
30  {
31  get { return innerSet.Count; }
32  }
33 
34  public IEnumerator<T> GetEnumerator()
35  {
36  return innerSet.GetEnumerator();
37  }
38 
39  System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
40  {
41  return innerSet.GetEnumerator();
42  }
43  }
44 }
bool Contains(T item)
Determines whether the set [contains] [the specified item].
Definition: ReadOnlySet.cs:24