0
I need to call a variable that is empty, but how to do it? I created the following code
public ActionResult Index()
{
cliente cliente;
try
{
cliente = db.cliente.find(id);
//etc
}
catch (Exception ex)
{
var GravaLogErro = new ErroDotNet
{
IDC = cliente != null ? cliente.ClienteId : 0
[Ele fala: User of unasigned local variable 'cliente']
};
GravaLogErro.GravarLog();
}
Didn’t want to put the client.find out from Try/catch until pq I summarized well the logic, why can’t I do a check if it is null? Right would be me raising her like this?
cliente cliente = new cliente();
There would be no problem later in find()?