Skip to content

Commit

Permalink
update addressbook example
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Jul 20, 2015
1 parent 352690e commit 43b1737
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions csharp/src/AddressBook/AddPerson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static Person PromptForAddress(TextReader input, TextWriter output)
break;
}

person.Phone.Add(phoneNumber);
person.Phones.Add(phoneNumber);
}
return person;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ public static int Main(string[] args)
}

// Add an address.
addressBook.Person.Add(PromptForAddress(Console.In, Console.Out));
addressBook.People.Add(PromptForAddress(Console.In, Console.Out));

// Write the new address book back to disk.
using (Stream output = File.OpenWrite(args[0]))
Expand Down
4 changes: 2 additions & 2 deletions csharp/src/AddressBook/ListPeople.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal class ListPeople
/// </summary>
private static void Print(AddressBook addressBook)
{
foreach (Person person in addressBook.Person)
foreach (Person person in addressBook.People)
{
Console.WriteLine("Person ID: {0}", person.Id);
Console.WriteLine(" Name: {0}", person.Name);
Expand All @@ -51,7 +51,7 @@ private static void Print(AddressBook addressBook)
Console.WriteLine(" E-mail address: {0}", person.Email);
}

foreach (Person.Types.PhoneNumber phoneNumber in person.Phone)
foreach (Person.Types.PhoneNumber phoneNumber in person.Phones)
{
switch (phoneNumber.Type)
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/src/AddressBook/SampleUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static void Main()
Id = 1,
Name = "Foo",
Email = "foo@bar",
Phone = { new Person.Types.PhoneNumber { Number = "555-1212" } }
Phones = { new Person.Types.PhoneNumber { Number = "555-1212" } }
};
using (MemoryStream stream = new MemoryStream())
{
Expand All @@ -61,7 +61,7 @@ private static void Main()
// And read the address book back again
AddressBook restored = AddressBook.Parser.ParseFrom(bytes);
// The message performs a deep-comparison on equality:
if (restored.Person.Count != 1 || !person.Equals(restored.Person[0]))
if (restored.People.Count != 1 || !person.Equals(restored.People[0]))
{
throw new ApplicationException("There is a bad person in here!");
}
Expand Down

0 comments on commit 43b1737

Please sign in to comment.