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(); }
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(); }