src/StarCitizen-API-Wrapper.Models/JsonConverters/Int/StringToIntConverter.cs
/// <summary>
/// Converts the given string json value to an int.
/// </summary>
Converts the given string json value to an int.
Converts the given string json value to an int .
public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var stringValue = reader.GetString();
            if (int.TryParse(stringValue, out var intResult))
                return intResult;
            try
            {
                return reader.GetInt32();
            }
            catch (InvalidOperationException e)
            {
                Debug.Fail(e.Message);
                throw;
            }
        }
public override int Read ( ref Utf8JsonReader reader , Type typeToConvert , JsonSerializerOptions options ) { var stringValue = reader . GetString ( ) ; if ( int . TryParse ( stringValue , out var intResult ) ) return intResult ; try { return reader . GetInt32 ( ) ; } catch ( InvalidOperationException e ) { Debug . Fail ( e . Message ) ; throw ; } }
Converts the given string json value to an int.
Converts the given string json value to an int .
Utf8JsonReader
ref
typeToConvert
Type
options
JsonSerializerOptions