summary refs log tree commit diff
path: root/crypto/src/util/collections/EnumerableProxy.cs
blob: 196b4d9df5b5803dfc0af082dfc5cb38deda6f90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections;
using System.Collections.Generic;

namespace Org.BouncyCastle.Utilities.Collections
{
	public sealed class EnumerableProxy
		: IEnumerable
	{
		private readonly IEnumerable inner;

		public EnumerableProxy(
			IEnumerable inner)
		{
			if (inner == null)
				throw new ArgumentNullException("inner");

			this.inner = inner;
		}

		public IEnumerator GetEnumerator()
		{
			return inner.GetEnumerator();
		}
	}

	internal sealed class EnumerableProxy<T>
		: IEnumerable<T>
	{
		private readonly IEnumerable<T> m_inner;

		internal EnumerableProxy(IEnumerable<T> inner)
		{
			if (inner == null)
				throw new ArgumentNullException("inner");

			m_inner = inner;
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return m_inner.GetEnumerator();
		}

		IEnumerator<T> IEnumerable<T>.GetEnumerator()
		{
			return m_inner.GetEnumerator();
		}
	}
}