Update proto2.md

Reworded info about message initialization
pull/6499/head
Sydney Acksman 5 years ago committed by GitHub
parent 7feb16a377
commit c9a9818075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      docs/csharp/proto2.md

@ -97,10 +97,9 @@ foo.GetOrInitializeExtension(RepeatedFooExt).Add(new Baz());
### Message initialization
Initialization refers to the status of required fields in a proto2 message. If a message is uninitialized, not all required fields are set in either the message itself or any of its submessages. Checking message initialization is not handled automatically by the library, but can be done manually via the
`IsInitialized` extension method in `MessageExtensions`. Please note, parsers and input streams don't check messages
for initialization on their own and throw errors. Instead it's up to you to handle messages with missing required fields
in whatever way you see fit.
Initialization refers to checking the status of required fields in a proto2 message. If a message is uninitialized, not all required fields are set in either the message itself or any of its submessages. In other languages, missing required fields throw errors depending on the merge method used. This could cause unforseen errors at runtime if the incorrect method is used.
However, in this implementation, parsers and input streams don't check messages for initialization on their own and throw errors. Instead it's up to you to handle messages with missing required fields in whatever way you see fit.
Checking message initialization can be done manually via the `IsInitialized` extension method in `MessageExtensions`.
### Extension registries

Loading…
Cancel
Save