aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-10-23 09:37:19 +0100
committerGravatar Jon Skeet <jonskeet@google.com>2015-10-30 09:37:01 +0000
commitf5a0a7feeb7dcde7f5eddd4548cbf08e9e3ccd57 (patch)
tree0eef3fbf64b377e72e1dd3b5ed891903e04909c6 /csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
parenta74e912a8be1274fd561db5e8133937d4e9c4a2b (diff)
Fix clearing wrapper type fields with reflection.
The nullable value type fields already worked, but the use of the CLR property concealed the difference between string and StringWrapper fields.
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs2
1 files changed, 1 insertions, 1 deletions
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);