Posts by Alexandre Gasparino • 98 points
2 posts
-
4
votes3
answers146
viewsQ: Performance "Where in foreach vs if"
Which case would perform best? var chaves = new list<string>(); foreach(var item in lista) { if(!string.IsNullOrEmpty(item.Chave)) { chaves.Add(item.Chave); } } Or listaValida = lista.Where(x…
-
4
votes2
answers62
viewsA: Error sorting list?
You can use Orderby(x => x.Fieldname) or Orderbydescending(x => x.Fieldname). Example: ViewBag.ListaEspecialidades = Especialidade.ListarEspecialidades().OrderBy(x => x.NomeDoCampo);…