1- // <copyright file="DoubleConverter .cs" company="Selenium Committers">
1+ // <copyright file="BiDiDoubleConverter .cs" company="Selenium Committers">
22// Licensed to the Software Freedom Conservancy (SFC) under one
33// or more contributor license agreements. See the NOTICE file
44// distributed with this work for additional information
2323
2424namespace OpenQA . Selenium . BiDi . Communication . Json . Converters
2525{
26- internal class DoubleConverter : JsonConverter < double >
26+ /// <summary>
27+ /// Serializes and deserializes <see cref="Double"/> into a
28+ /// <see href="https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue">BiDi spec-compliant number value</see>.
29+ /// </summary>
30+ internal sealed class BiDiDoubleConverter : JsonConverter < double >
2731 {
28- public override double Read ( ref Utf8JsonReader reader , System . Type typeToConvert , JsonSerializerOptions options )
32+ public override double Read ( ref Utf8JsonReader reader , Type typeToConvert , JsonSerializerOptions options )
2933 {
3034 if ( reader . TryGetDouble ( out double d ) )
3135 {
@@ -34,19 +38,19 @@ public override double Read(ref Utf8JsonReader reader, System.Type typeToConvert
3438
3539 var str = reader . GetString ( ) ?? throw new JsonException ( ) ;
3640
37- if ( str . Equals ( "-0" , System . StringComparison . Ordinal ) )
41+ if ( str . Equals ( "-0" , StringComparison . Ordinal ) )
3842 {
3943 return - 0.0 ;
4044 }
41- else if ( str . Equals ( "NaN" , System . StringComparison . Ordinal ) )
45+ else if ( str . Equals ( "NaN" , StringComparison . Ordinal ) )
4246 {
4347 return double . NaN ;
4448 }
45- else if ( str . Equals ( "Infinity" , System . StringComparison . Ordinal ) )
49+ else if ( str . Equals ( "Infinity" , StringComparison . Ordinal ) )
4650 {
4751 return double . PositiveInfinity ;
4852 }
49- else if ( str . Equals ( "-Infinity" , System . StringComparison . Ordinal ) )
53+ else if ( str . Equals ( "-Infinity" , StringComparison . Ordinal ) )
5054 {
5155 return double . NegativeInfinity ;
5256 }
0 commit comments