mercredi 29 juin 2016

C# if statement list check

hey guys I need some help. basically I need to check web extensions. i dont want to sit and write out each one as follows

if (RegEmail.Text.Contains("@") &&   (RegEmail.Text.Contains(".com")||RegEmail.Text.Contains(".net"))
        {
            RegEmailB = true;

            //RegEmail.Background = _orginalDrawable;
            RegEmail.SetTextColor(Color.Green);
        }

i would like to do something like this

        string emailExtensions = ".co.za" + ".com";
        if (RegEmail.Text.Contains("@") && RegEmail.Text.Contains(emailExtensions))
        {
            RegEmailB = true;

            //RegEmail.Background = _orginalDrawable;
            RegEmail.SetTextColor(Color.Green);
        }

but i dont know how to go about it..

Aucun commentaire:

Enregistrer un commentaire