I'm using ASP.NET Core 5.0 MVC. So I'm using C# 9
In my HomeController.cs
I'm using the String.EndsWith Method to work with a string
I have a string variable holding an email address like this:
This works fine. This if statements checks to make sure the string ends in @yahoo.com
// declare a string variable called strTestEmailAddress
string strTestEmailAddress = "firstname.lastname@example.org";
// if email address ends in @yahoo.com do stuff inside this if statement
Is there a way to use EndsWith to check for 2 types of emails?
Sometimes the variable strTestEmailAddress will hold a @yahoo.com email address and other times it will hold a @microsoft.com email address.
So I need to check if the string the variable strTestEmailAddress ends in @yahoo.com OR @microsoft.com
Anyone know the if statement syntax for that?
if ( )
// if email address ends in @yahoo.com or @microsoft.com do stuff inside this if statement
Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>