示例#1
0
        private static void PatternMatchingDemo()
        {
            PatternMatching patternMatching = new PatternMatching();
            // patternMatching.PatternMatchingForIs(DayOfWeek.Friday);

            var value = new List <DayOfWeek>()
            {
                DayOfWeek.Monday, DayOfWeek.Friday
            };

            // var value = new List<int>() { 1, 2, 3 };
            patternMatching.PatternMatchingGenericForIs <DayOfWeek>(value);
        }
示例#2
0
        private static void PatternMatchingDemo2()
        {
            PatternMatching patternMatching = new PatternMatching();

            patternMatching.PatternMatchingSwitch(new List <object>()
            {
                10,
                -1,
                5,
                new Person("Tom", 40),
                "abc",
                new Person("Joe", 10),
                null,
            });
        }