示例#1
0
        // Struct = Immutable object
        // Tuples = Anonymous Immutable object
        // Class = Mutable object

        public static void Run()
        {
            // Oneliner
            Str1 str4 = new Str1 {
                name = "Joe", age = 44
            };

            Str1 str1;

            str1.name = "Joe";
            str1.age  = 44;
            str1.doSomething();
            Console.WriteLine(str1.getSomething());


            Str2 str2 = new Str2("Joe", 44);

            str2.doSomething();
            Console.WriteLine(str2.getSomething());

            Str3 str3 = new Str3();

            str3.name = "Joe";
            str3.age  = 44;
            str3.doSomething();
            Console.WriteLine(str3.getSomething());
        }
示例#2
0
文件: Program.cs 项目: lekss361/test
        static void Main(string[] args)
        {
            //int x = 15;
            //int y = 1;
            //int z = 0;
            //for (int i = 1; i < x; i++)
            //{
            //    y *= i;
            //}
            //while (y % 10 == 0)
            //{
            //    y /= 10;
            //    z++;
            //}
            //Console.WriteLine($"нулей на конце {z}");

            string[] Line = File.ReadAllLines(@"C:\Users\Aleks\Source\Repos\s4hana-ext-deploy-custom-ui\webapp\controller\Detail.controller.js", Encoding.Default);

            List <string> Function            = new List <string>();
            List <int>    CountInputParametrs = new List <int>();

            int    Str1, Str2;
            string Str3;

            foreach (string item in Line)
            {
                Str1 = item.IndexOf("function (");
                Str2 = item.IndexOf("_");

                if (Str1 != -1 && Str2 != -1)
                {
                    Function.Add(item);
                }
            }

            for (int i = 0; i < Function.Count; i++)
            {
                if (Function[i].IndexOf("function ()") != -1)
                {
                    Function.RemoveAt(i);
                    i--;
                }
            }

            foreach (string item in Function)
            {
                int Tmp1 = 0;
                Str3 = item;
                do
                {
                    Str1 = Str3.IndexOf(",");
                    Tmp1++;
                    if (Str1 == -1)
                    {
                        CountInputParametrs.Add(Tmp1);
                        continue;
                    }

                    Str3 = Str3.Substring(Str1 + 1);
                } while (Str1 != -1);
            }

            for (int i = 0; i < Function.Count; i++)
            {
                Str1        = Function[i].IndexOf(")") + 1;
                Function[i] = Function[i].Substring(0, Str1);
                Console.WriteLine($"{Function[i]} : {CountInputParametrs[i]}");
            }
        }