コード例 #1
0
ファイル: MainApp.cs プロジェクト: olik369/CSharpLecture
        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;
コード例 #2
0
        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]);
コード例 #3
0
ファイル: Range.cs プロジェクト: somnomania/smapi-mod-dump
 public Range(Index start, Index end)
 {
     Start = start;
     End   = end;
 }