Exemple #1
0
        public static Tuple <string, int> ExampleMethod(int i)
        {
            TestObjectGeneric <string> test = new TestObjectGeneric <string>();

            try {
                Console.WriteLine(StringOriginal);

                Counter += new int?(i).Value;

                Console.WriteLine(new List <TestObjectGeneric <TestObject> >()
                {
                    new TestObjectGeneric <TestObject>()
                }.GetEnumerator().Current);

                List <string> list = new List <string>();
                list.AddRange(new string[] { "A", "B", "C" });
                foreach (string str in list)
                {
                    TargetTest("A", str);
                }
            } catch (Exception) {
                return(Tuple.Create("", -1));
            }
            return(Tuple.Create(StringOriginal, Counter));
        }
        public static Tuple <string, int> ExampleMethod(int i)
        {
            if (i == 1337)
            {
                return(ExampleMethod(0));
            }

            TestObjectGeneric <string> test = new TestObjectGeneric <string>();

            try {
                Console.WriteLine(StringOriginal);

                Counter += new int?(i).Value;
                Counter += new TestObjectInheritsGeneric();

                Console.WriteLine(new List <TestObjectGeneric <TestObject> >()
                {
                    new TestObjectGeneric <TestObject>()
                }.GetEnumerator().Current);

                List <string> list = new List <string>();
                list.AddRange(new string[] { "A", "B", "C" });

                string[][] array2d1 = new string[][] { new string[] { "A" } };
                string[,] array2d2 = new string[, ] {
                    { "B" }
                };
                foreach (string str in list)
                {
                    TargetTest(array2d1[0][0], array2d2[0, 0], str);
                    TargetTest(array2d1[0][0], array2d2[0, 0]);
                    TargetTest(array2d1[0][0], ref array2d2[0, 0]);
                    TargetTest <int>();
                    TargetTest <int, int>();
                }

                switch (i)
                {
                case 0:
                    i *= -2;
                    break;

                case 1:
                    i *= 2;
                    break;
                }
            } catch (Exception e) when(e == null)
            {
                return(Tuple.Create("", -2));
            } catch (Exception) {
                return(Tuple.Create("", -1));
            }
            return(Tuple.Create(StringOriginal, Counter));
        }
        public static Tuple <string, int> ExampleMethod(int i)
        {
            TestObjectGeneric <string> test = new TestObjectGeneric <string>();

            try {
                Console.WriteLine(StringOriginal);
                Counter += i;
            } catch (Exception) {
                return(Tuple.Create("", -1));
            }
            return(Tuple.Create(StringOriginal, Counter));
        }
Exemple #4
0
        public static Counter <int> TestStaticMethod(int a, int b)
        {
            TestObjectGeneric <string> test = new TestObjectGeneric <string>();

            try {
                a *= new int?(b).Value;

                b += new List <TestObjectGeneric <TestObject> >()
                {
                    new TestObjectGeneric <TestObject>()
                }.GetEnumerator().Current?.GetHashCode() ?? 0;

                List <string> list = new List <string>();
                list.AddRange(new string[] { "A", "B", "C" });

                string[][] array2d1 = new string[][] { new string[] { "A" } };
                string[,] array2d2 = new string[, ] {
                    { "B" }
                };
                foreach (string str in list)
                {
                    TargetTest(array2d1[0][0], array2d2[0, 0], str);
                }
            } catch (Exception e) when(e == null)
            {
                return(new Counter <int> {
                    Count = -2
                });
            } catch (Exception) {
                return(new Counter <int> {
                    Count = -1
                });
            }
            return(new Counter <int> {
                Count = a
            });
        }