aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf/Reflection
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs2
-rw-r--r--csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs2
2 files changed, 2 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
index 619a6ac8..3d6cc59f 100644
--- a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
@@ -197,7 +197,7 @@ namespace Google.Protobuf.Reflection
}
/// <summary>
- /// Returns the type of the field.
+ /// Returns the type of the field.
/// </summary>
public FieldType FieldType
{
diff --git a/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs b/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
index de92fbc1..bbac2173 100644
--- a/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
@@ -61,7 +61,7 @@ namespace Google.Protobuf.Reflection
// TODO: Validate that this is a reasonable single field? (Should be a value type, a message type, or string/ByteString.)
object defaultValue =
- typeof(IMessage).IsAssignableFrom(clrType) ? null
+ descriptor.FieldType == FieldType.Message ? null
: clrType == typeof(string) ? ""
: clrType == typeof(ByteString) ? ByteString.Empty
: Activator.CreateInstance(clrType);