Exemple #1
0
        static void Main(string[] args)
        {
            System.Index last = ^ 1;

            int[] scores = new int[5];
            scores[0]   = 80;
            scores[1]   = 74;
            scores[2]   = 81;
            scores[^ 2] = 90;
        public void test_index1_string()
        {
            string s = "hello";
            // using System.Index
            var firstIndex = new System.Index(0, false);
            var lastIndex  = new System.Index(1, true); // long for ^1

            Assert.Equal('h', s[firstIndex]);
            Assert.Equal('o', s[lastIndex]);
            // using array index
            Assert.Equal('h', s[0]);
            Assert.Equal('o', s[^ 1]);
Exemple #3
0
 public Range(Index start, Index end)
 {
     Start = start;
     End   = end;
 }