aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2008-11-24 11:17:17 +0000
committerJon Skeet <skeet@pobox.com>2008-11-24 11:17:17 +0000
commit828510cdbda47eff58682fd62c9166c39194810c (patch)
tree7a45aea7209b10459fb6ca050ed6c4fb9a77ffbc /src
parent4cf9e3c619fbd00e47d5ec2503801814d3c8b4b6 (diff)
downloadprotobuf-828510cdbda47eff58682fd62c9166c39194810c.tar.gz
protobuf-828510cdbda47eff58682fd62c9166c39194810c.tar.bz2
protobuf-828510cdbda47eff58682fd62c9166c39194810c.zip
Refactor IsInitialized to match Java version
Diffstat (limited to 'src')
-rw-r--r--src/ProtocolBuffers/GeneratedMessage.cs14
1 files changed, 4 insertions, 10 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