Is there a LINQ method that returns a default value of my preference that fulfills the role of this method more efficiently?
public static int? procurarIdPorCpf(string cpf)
{
using (Contexto context = new Contexto())
{
if (context.pessoaFisica.Any(p => p.CPF.Equals(cpf)))
return context.pessoaFisica.First(p => p.CPF.Equals(cpf)).ID;
else
return null;
}
}