コード例 #1
0
    static void Main()
    {
        Introduction::NamespaceExample NSEx =
            new Introduction::NamespaceExample();

        WriteLine(NSEx.GetNamespace());
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: wxf1116/study
    public static int Main()
    {
        Introduction::NamespaceExample NSEx =
            new Introduction::NamespaceExample();

        Console.WriteLine(NSEx.GetNamespace());
        return(0);
    }
コード例 #3
0
ファイル: Program.cs プロジェクト: ElvinChan/CSharpExp
        static int Main(string[] args)
        {
            //::命名空间别名限定符运算符。直接查找名为Introduction的命名空间
            Introduction::NamespaceExample NSEx = new Introduction::NamespaceExample();

            //以下代码获取this下的NamespaceExample子类
            NamespaceExample NSExFake = new NamespaceExample();

            Console.WriteLine(NSEx.GetNamespace());

            Console.WriteLine(NSExFake.GetNamespace());
            Console.ReadKey();
            return 0;
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var name     = "Bob";
            var age      = 21;
            var isRabbit = true;

            {
                int dupaukryta = 12;
                WriteLine(dupaukryta);
            }

            Type nameType     = name.GetType();
            Type ageType      = age.GetType();
            Type isRabbitType = isRabbit.GetType();

            WriteLine($"name is type {nameType}");
            WriteLine($"name is type {name.GetType()}");
            WriteLine($"age is type {ageType}");
            WriteLine($"isRabbit is type {isRabbitType}");

            int a = 23;

            string s = a.ToString();

            WriteLine($"{s} = {a}");

            char characters     = '\x0051';
            char characters1    = (char)65;
            char alert          = '\a';
            char backspace      = '\b';
            char formFeed       = '\f';
            char Carriagereturn = '\r';
            char vericaltab     = '\v';

            WriteLine(characters + " " + characters1);
            //WriteLine(alert);
            WriteLine("stackoverflow " + '\b' + " is " + backspace + " good");
            WriteLine(vericaltab);
            WriteLine("dupa" + Carriagereturn + "pa");
            //WriteLine("stackoverflow" + formFeed + "is" + formFeed + "good");


            string jeby = @"'Cos tam mam
            ale nie dam";

            WriteLine(jeby);

            int b = 2;


            if (DoSomething(b) != 0)
            {
                WriteLine(DoSomething(b));
            }
            else
            {
                WriteLine("Zero");
            }
            WriteLine("\n\n\n\n");

            string[] arrayOfStrings = new string[5];

            for (int i = 0; i < 5; i++)
            {
                arrayOfStrings[i] = "string_" + i.ToString();
            }

            int[] arrayOfInts = new int[5];

            goto Label1;
            foreach (var item in arrayOfStrings)
            {
                WriteLine(item);
            }
            arrayOfInts[2] = 2;
Label1:
            foreach (var item in arrayOfInts)
            {
                Write($"{item} \t");
            }
            WriteLine();

            TimeOfDay time = TimeOfDay.Afternoon;

            WriteLine(time.ToString());

            TimeOfDay time2 = (TimeOfDay)Enum.Parse(typeof(TimeOfDay), "morning", true);

            WriteLine((int)time2);

            //namespace
            Introduction::NamespaceExample NSEx = new Introduction::NamespaceExample();

            WriteLine(NSEx.GetNamespace());


            for (int i = 0; i < args.Length; i++)
            {
                WriteLine(args[i]);
            }
            var customer1 = new PhoneCustomer();


            WriteLine($"\n{customer1.GetType()}");
            WriteLine($"{customer1.Data.GetType()}");
            WriteLine($"{customer1.DataAutoImplemented}");

            string message      = "WITAM";
            string upperMessage = message.ToLower();

            WriteLine(upperMessage);

            int xMessage = 2017;

            message += xMessage.ToString();
            WriteLine(message);


            // C# 6.0 pl

            int[,] matrix2D = new int[3, 3];

            int[,] rectangularMatrix =
            {
                { 0, 1, 2 },
                { 0, 2, 3 },
                { 1, 2, 3 }
            };

            int[][] matrix = new int[][]
            {
                new int[] { 3, 3, 3 },
                new int[] { 2, 2, 2 },
                new int[] { 1, 1, 1, 2 }
            };

            var matrixVar = new int[][]
            {
                new int[] { 3, 3, 3 },
                new int[] { 2, 2, 2 },
                new int[] { 1, 1, 1, 2 }
            };

            var charArray = new[] { 'a', 'b', 'c' };

            //różna długość tablicy wewn
            int[][] matrix2 = new int[3][];
        }
コード例 #5
0
 static void Main()
 {
     Introduction::NamespaceExample NSEx =
       new Introduction::NamespaceExample();
     WriteLine(NSEx.GetNamespace());
 }