OLD | NEW |
1 #region Copyright notice and license | 1 #region Copyright notice and license |
2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
3 // Copyright 2008 Google Inc. All rights reserved. | 3 // Copyright 2008 Google Inc. All rights reserved. |
4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
8 // met: | 8 // met: |
9 // | 9 // |
10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 AddressBook book = new AddressBook | 59 AddressBook book = new AddressBook |
60 { | 60 { |
61 People = { copy } | 61 People = { copy } |
62 }; | 62 }; |
63 bytes = book.ToByteArray(); | 63 bytes = book.ToByteArray(); |
64 // And read the address book back again | 64 // And read the address book back again |
65 AddressBook restored = AddressBook.Parser.ParseFrom(bytes); | 65 AddressBook restored = AddressBook.Parser.ParseFrom(bytes); |
66 // The message performs a deep-comparison on equality: | 66 // The message performs a deep-comparison on equality: |
67 if (restored.People.Count != 1 || !person.Equals(restored.People[0])
) | 67 if (restored.People.Count != 1 || !person.Equals(restored.People[0])
) |
68 { | 68 { |
69 throw new ApplicationException("There is a bad person in here!")
; | 69 throw new Exception("There is a bad person in here!"); |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 } | 73 } |
OLD | NEW |