Skip to content

Instantly share code, notes, and snippets.

@andrebaltieri
Created August 29, 2022 19:33
Show Gist options
  • Save andrebaltieri/3894495efb1025d86d8b8c9cef168300 to your computer and use it in GitHub Desktop.
Save andrebaltieri/3894495efb1025d86d8b8c9cef168300 to your computer and use it in GitHub Desktop.
var minhaLista = new List<Food> {
new Food { Type = "Mineira"},
new Food { Type = "Italiana"},
new Food { Type = "Japonesa"}
};
for (int i = 0; i <= minhaLista.Count; i++)
{
var item = minhaLista[i];
Console.WriteLine(item.Type);
}
foreach (var item in minhaLista)
{
Console.WriteLine(item.Type);
}
public class Food
{
public string Type { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment