diff options
author | Jon Skeet <skeet@pobox.com> | 2008-11-24 11:17:17 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2008-11-24 11:17:17 +0000 |
commit | 828510cdbda47eff58682fd62c9166c39194810c (patch) | |
tree | 7a45aea7209b10459fb6ca050ed6c4fb9a77ffbc | |
parent | 4cf9e3c619fbd00e47d5ec2503801814d3c8b4b6 (diff) | |
download | protobuf-828510cdbda47eff58682fd62c9166c39194810c.tar.gz protobuf-828510cdbda47eff58682fd62c9166c39194810c.tar.bz2 protobuf-828510cdbda47eff58682fd62c9166c39194810c.zip |
Refactor IsInitialized to match Java version
-rw-r--r-- | src/ProtocolBuffers/GeneratedMessage.cs | 14 | ||||
-rw-r--r-- | todo.txt | 1 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/ProtocolBuffers/GeneratedMessage.cs b/src/ProtocolBuffers/GeneratedMessage.cs index 7b4ae209..d8747599 100644 --- a/src/ProtocolBuffers/GeneratedMessage.cs +++ b/src/ProtocolBuffers/GeneratedMessage.cs @@ -84,20 +84,14 @@ namespace Google.ProtocolBuffers { public override bool IsInitialized { get { - /* if (!DescriptorForType.HasRequiredFields) { - return true; - }*/ - // Check that all required fields are present. foreach (FieldDescriptor field in DescriptorForType.Fields) { + // Check that all required fields are present. if (field.IsRequired && !HasField(field)) { return false; } - } - - // Check that embedded messages are initialized. - // This code is similar to that in AbstractMessage, but we don't - // fetch all the field values - just the ones we need to. - foreach (FieldDescriptor field in DescriptorForType.Fields) { + // Check that embedded messages are initialized. + // This code is similar to that in AbstractMessage, but we don't + // fetch all the field values - just the ones we need to. if (field.MappedType == MappedType.Message) { if (field.IsRepeated) { // We know it's an IList<T>, but not the exact type - so @@ -2,7 +2,6 @@ Current task list (not in order) Diff stuff -- Refactor IsInitialized - Performance framework - Optionally remove dependencies to core and csharp options - Remove multifile support |