50
1
using System;
2
3
class Program
4
{
5
static void Main(string[] args)
6
{
7
string email = "myemail@email.com";
8
bool isValid = ValidateEmail(email);
9
10
Console.WriteLine($"Is {email} a valid email? {isValid}");
11
}
12
13
static bool ValidateEmail(string email)
14
{
15
if (string.IsNullOrWhiteSpace(email))
16
{
17
return false;
18
}
19
20
string[] parts = email.Split('@');
21
if (parts.Length != 2)
22
{
23
return false; // email must have exactly one @ symbol
24
}
Cached Result
Digite o primeiro valor:
>