コード例 #1
0
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            var replayResult = UnvalidateReplay.CreateBody("MyRespondForQuestion");


            replayResult.Match(
                Succ: replay =>
            {
                ReplayComplete(replay);
                Console.WriteLine("Replay address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid replay address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");

            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );

            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: adrian2202/PSSC-2020
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Email invalid because: {ex.Message}");
                return(Unit.Default);
            }
                );


            var replayResult = Replay.CreateBody("My response is the best");


            replayResult.Match(
                Succ: replay =>
            {
                Console.WriteLine("Replay valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Replay invalid because: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            //question

            var cmdQuestion    = new CreateQuestionCmd("Ce se face in c#?", "Va rog sa ma ajutati ca nu stiu ce sa fac in c#", new string[] { "C#", "C", "C++" }, 3);
            var questionResult = InvalidateQuestion.Create(cmdQuestion);

            questionResult.Match(
                Succ: question =>
            {
                PostedQuestion(question);
                Console.WriteLine($"Question with title \"{question.Question.Title}\" is valid");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid Question.\n Reason: {ex.Message}");
                return(Unit.Default);
            }
                );

            Console.ReadLine();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");


            emailResult.Match(
                    Succ: email =>
                    {
                        SendResetPasswordLink(email);

                        Console.WriteLine("Email address is valid.");
                        return Unit.Default;
                    },
                    Fail: ex =>
                    {
                        Console.WriteLine($"Email adress is invalid. Reason: {ex.Message}");
                        return Unit.Default;
                    }
                );


            var replayResult = Replay.CreateBody("MyRespondForQuestion");


            replayResult.Match(
                    Succ: replay =>
                    {
                        Console.WriteLine("Replay address is valid.");
                        return Unit.Default;
                    },
                    Fail: ex =>
                    {
                        Console.WriteLine($"Invalid replay address. Reason: {ex.Message}");
                        return Unit.Default;
                    }
                );


            Console.ReadLine();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");

            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address! Reason: {ex.Message}");
                return(Unit.Default);
            }
                );



            var cmdQuestion    = new CreateQuestionCmd("How can I get int value from enum in C#?", new string[] { "C#", "int", "enums" }, 3);
            var questionResult = InvalidateQuestion.Create(cmdQuestion);

            questionResult.Match(
                Succ: question =>
            {
                PostedQuestion(question);
                Console.WriteLine($"Question with title \"{question.Question.Title}\" is valid!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid Question!\n Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            Console.ReadLine();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: Ranga-Adrian/PSSC-2020
        static void Main(string[] args)
        {
            var emailResult    = UnverifiedEmail.Create("*****@*****.**");
            var questionResult = UnverifiedQuestion.Create("How to create an array of objects in C++?", "I am trying to create an array of objects of my class in c++. When I print the objects, it skips the first element of array (a[0]). I have read many forums, but I can't find the problem. Who can see it?.", "c++");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            emailResult.Match(
                Succ: question =>
            {
                SendResetPasswordLink(question);

                Console.WriteLine("Question is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: DariusB2/PSSC-2020
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");

            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid!!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address! Reason: {ex.Message}");
                return(Unit.Default);
            }
                );

            var cmdQuestion    = new CreateQuestionCmd("What is a NullReferenceException, and how do I fix it?", new string[] { "C#", ".net", "vb.net" }, 3);
            var questionResult = InvalidateQuestion.Create(cmdQuestion);

            questionResult.Match(
                Succ: question =>
            {
                PostedQuestion(question);
                Console.WriteLine($"Question with title \"{question.Question.Title}\" is valid!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid Question!\n Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            Console.ReadLine();
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: scritian/PSSC-2020
        static void Main(string[] args)
        {
            var emailResult    = UnverifiedEmail.Create("*****@*****.**");
            var questionResult = InvalidatedQuestion.Create("How are you?", "tag1 tag2 tag3");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(LanguageExt.Unit.Default);
            }
                );

            questionResult.Match(
                Succ: question =>
            {
                Console.WriteLine("Question is valid.");

                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid Question. {ex.Message}");
                return(LanguageExt.Unit.Default);
            }
                );

            Console.ReadLine();
        }