My task is to use Pattern Matching to make an Employee
selection where the Email
will not be null
and the first two languages of the employee will be "ru"
and "en"
How do I make a check for not null and check the first two elements of the Languages ?
Here's what I have
public static string IsRuEnWithEmail(Employee emp) => emp switch
{
{ Email: != null, Languages: { "ru", "en" } } =>
$"{emp.FCs}, {emp.Email}, {emp.Role}",
_ => "",
};
It doesn't work at all
Errors say that it is impossible to compare this way
string
return type from a method with nameIsXXX()
would be rather surprising for me. And I'd have to refer to docs to see what it does.