Skip to content

Commit adcaff5

Browse files
committed
Small cleanup item; ReadName already returns null if CurrentName isn't a string.
1 parent 0b78790 commit adcaff5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Bson/Serialization/Serializers/KeyValuePairSerializer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ public override object Deserialize(
104104
bool keyFound = false, valueFound = false;
105105
while (bsonReader.ReadBsonType(__bsonTrie) != BsonType.EndOfDocument)
106106
{
107-
bsonReader.ReadName();
108-
var elementName = bsonReader.CurrentName as string;
107+
var elementName = bsonReader.ReadName();
109108
if (elementName != null)
110109
{
111110
var message = string.Format("Element '{0}' is not valid for KeyValuePairs (expecting 'k' or 'v').", elementName);

0 commit comments

Comments
 (0)