Commit 828510cd authored by Jon Skeet's avatar Jon Skeet

Refactor IsInitialized to match Java version

parent 4cf9e3c6
...@@ -84,20 +84,14 @@ namespace Google.ProtocolBuffers { ...@@ -84,20 +84,14 @@ namespace Google.ProtocolBuffers {
public override bool IsInitialized { public override bool IsInitialized {
get { get {
/* if (!DescriptorForType.HasRequiredFields) {
return true;
}*/
// Check that all required fields are present.
foreach (FieldDescriptor field in DescriptorForType.Fields) { foreach (FieldDescriptor field in DescriptorForType.Fields) {
// Check that all required fields are present.
if (field.IsRequired && !HasField(field)) { if (field.IsRequired && !HasField(field)) {
return false; return false;
} }
} // Check that embedded messages are initialized.
// This code is similar to that in AbstractMessage, but we don't
// Check that embedded messages are initialized. // fetch all the field values - just the ones we need to.
// 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) {
if (field.MappedType == MappedType.Message) { if (field.MappedType == MappedType.Message) {
if (field.IsRepeated) { if (field.IsRepeated) {
// We know it's an IList<T>, but not the exact type - so // We know it's an IList<T>, but not the exact type - so
......
...@@ -2,7 +2,6 @@ Current task list (not in order) ...@@ -2,7 +2,6 @@ Current task list (not in order)
Diff stuff Diff stuff
- Refactor IsInitialized
- Performance framework - Performance framework
- Optionally remove dependencies to core and csharp options - Optionally remove dependencies to core and csharp options
- Remove multifile support - Remove multifile support
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment