Is there a difference between these two ways to start a variable?
List<classeterapeutica> itens = new List<classeterapeutica>();
modelOff.classeterapeuticas.ToList();
or
List<classeterapeutica> itens = modelOff.classeterapeuticas.ToList();
Is there a difference between these two ways to start a variable?
List<classeterapeutica> itens = new List<classeterapeutica>();
modelOff.classeterapeuticas.ToList();
or
List<classeterapeutica> itens = modelOff.classeterapeuticas.ToList();
It is not a matter of being correct, but initializing a variable with a value to change this value on the next line does not make sense, so the second code is preferable. Only assign a value to a variable if this value will be used somewhere. If it is discarded without use it is a bad thing.