Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var questionResult = UnpublishedQuestion.Create("Can a programmer live without errors?", new List <string>()
            {
                "errors", "programming"
            });


            questionResult.Match(
                Succ: question =>
            {
                VoteQuestion(question);
                Console.WriteLine("This question can be voted! *happy dance*");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"The question couldn't be published because {ex.Message}");
                return(Unit.Default);
            }
                );
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var questionResult = UnpublishedQuestion.Create("What is a neural network?", new List <string>()
            {
                "python", "neural-network"
            });


            questionResult.Match(
                Succ: question =>
            {
                VoteQuestionButton(question);
                Console.WriteLine("Can vote!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Question could not be published. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            Console.ReadLine();
        }