Skip to content

Commit 043edd6

Browse files
azchohfiSergio0694
andauthored
Update Microsoft.Toolkit.Services/Services/Twitter/TwitterCoordinatesConverter.cs
Co-authored-by: Sergio Pedri <sergio0694@live.com>
1 parent b446d06 commit 043edd6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Microsoft.Toolkit.Services/Services/Twitter/TwitterCoordinatesConverter.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@ public override bool CanConvert(Type objectType)
2222

2323
public TwitterCoordinatesConverter(JsonSerializerOptions options)
2424
{
25-
if (options?.GetConverter(typeof(double)) is JsonConverter<double> doubleConverter)
26-
{
27-
_doubleConverter = doubleConverter;
28-
}
29-
else
30-
{
31-
throw new InvalidOperationException();
32-
}
25+
_doubleConverter = options?.GetConverter(typeof(double)) as JsonConverter<double> ?? throw new InvalidOperationException();
3326
}
3427

3528
public override TwitterCoordinates Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
@@ -119,4 +112,4 @@ public override void Write(Utf8JsonWriter writer, TwitterCoordinates value, Json
119112
throw new NotImplementedException();
120113
}
121114
}
122-
}
115+
}

0 commit comments

Comments
 (0)