Skip to content

Instantly share code, notes, and snippets.

@townivan
Created January 17, 2020 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save townivan/a4381ccbcc7f534b40a3e3e63fe3ffeb to your computer and use it in GitHub Desktop.
Save townivan/a4381ccbcc7f534b40a3e3e63fe3ffeb to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
// test at https://dotnetfiddle.net/
public class Program
{
public static void Main()
{
Console.WriteLine("List practice");
List<Person> peeps = new List<Person>();
peeps.Add(new Person {FirstName = "Bill", LastName = "Jones" });
peeps.Add(new Person {FirstName = "Cindy", LastName = "Smith" });
foreach(var peep in peeps)
{
Console.WriteLine($"The person is {peep.FirstName} {peep.LastName}");
}
}
}
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment