Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SpanSpecial.cs « mdoc.Test « mdoc - github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bcf197e21e98dd6736cc750364e2b0460b6036ef (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;

namespace mdoc.Test
{
    public struct SpanSpecial<T>
    {
        public struct Enumerator
        {
            private readonly SpanSpecial<T> _span;

            private int _index;

            public T Current
            {
                get
                {
                    return this._span[this._index];
                }
            }

            internal Enumerator(SpanSpecial<T> span)
            {
                this._span = span;
                this._index = -1;
            }

            public bool MoveNext()
            {
                int num = this._index + 1;
                if (num < this._span.Length)
                {
                    this._index = num;
                    return true;
                }
                return false;
            }
        }

        private readonly int _length;

        public int Length
        {
            get
            {
                return this._length;
            }
        }

        public bool IsEmpty
        {
            get
            {
                return this._length == 0;
            }
        }

        public static SpanSpecial<T> Empty
        {
            get
            {
                return default(SpanSpecial<T>);
            }
        }

        public ref T this[int index]
        {
            get
            {
                if (index >= this._length)
                {
                    throw new Exception("error");
                }

                return  ref this[index];
      
            }
        }

        public SpanSpecial<T>.Enumerator GetEnumerator()
        {
            return new SpanSpecial<T>.Enumerator(this);
        }

        public SpanSpecial( int length)
        {
            this._length = length;
        }

    }
}