blob: 62a823b1535edb4561feafb35479eb6384080867 (
plain)
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
|
using System.Collections;
using System.Collections.Generic;
namespace Xamarin.Forms
{
internal class CastingEnumerator<T, TFrom> : IEnumerator<T> where T : class where TFrom : class
{
readonly IEnumerator<TFrom> _enumerator;
bool _disposed;
public CastingEnumerator(IEnumerator<TFrom> enumerator)
{
_enumerator = enumerator;
}
public void Dispose()
{
if (_disposed)
return;
_disposed = true;
_enumerator.Dispose();
}
object IEnumerator.Current
{
get { return Current; }
}
public bool MoveNext()
{
return _enumerator.MoveNext();
}
public void Reset()
{
_enumerator.Reset();
}
public T Current
{
get { return _enumerator.Current as T; }
}
}
}
|