/// <summary> /// Defines a conditional reinterpret cast to a byte sequence. /// </summary> /// <param name="canConvert"></param> /// <param name="asBytes">A ReadOnlySpan<byte> view of a value.</param> public ScalarBuilder With( Func <TParams, bool> canConvert, AsSpan <TParams, byte> asBytes) { canConvert.ThrowIfNull(nameof(canConvert)); asBytes.ThrowIfNull(nameof(asBytes)); _builder.Converters.Add(ValueBinder.Converter.Blob(canConvert, asBytes)); return(this); }
/// <summary> /// Defines a conditional reinterpret cast to a UTF-16 string. /// </summary> /// <param name="canConvert"></param> /// <param name="asText">A ReadOnlySpan<char> view of a value.</param> public ScalarBuilder With( Func <TParams, bool> canConvert, AsSpan <TParams, char> asText) { canConvert.ThrowIfNull(nameof(canConvert)); asText.ThrowIfNull(nameof(asText)); _builder.Converters.Add(ValueBinder.Converter.Utf16Text(canConvert, asText)); return(this); }
/// <summary> /// Defines a reinterpret cast from a member value to a byte sequence. /// </summary> /// <param name="propertyOrField"></param> /// <param name="asBytes">A ReadOnlySpan<byte> view of a value.</param> public Builder With <TField>( Expression <Func <TParams, TField> > propertyOrField, AsSpan <TField, byte> asBytes) { propertyOrField.ThrowIfNull(nameof(propertyOrField)); asBytes.ThrowIfNull(nameof(asBytes)); GetOrAdd(propertyOrField) .Converters .Add(ValueBinder.Converter.Blob(asBytes)); return(this); }
/// <summary> /// Defines a reinterpret cast from a member value to a UTF-16 string. /// </summary> /// <param name="propertyOrField"></param> /// <param name="asText">A ReadOnlySpan<char> view of a value.</param> public Builder With <TField>( Expression <Func <TParams, TField> > propertyOrField, AsSpan <TField, char> asText) { propertyOrField.ThrowIfNull(nameof(propertyOrField)); asText.ThrowIfNull(nameof(asText)); GetOrAdd(propertyOrField) .Converters .Add(ValueBinder.Converter.Utf16Text(asText)); return(this); }
/// <summary> /// Defines a reinterpret cast to a byte sequence. /// </summary> /// <param name="asBytes">A ReadOnlySpan<byte> view of a value.</param> public ScalarBuilder With(AsSpan <TParams, byte> asBytes) { asBytes.ThrowIfNull(nameof(asBytes)); _builder.Converters.Add(ValueBinder.Converter.Blob(asBytes)); return(this); }
/// <summary> /// Defines a reinterpret cast to a UTF-16 string. /// </summary> /// <param name="asText">A ReadOnlySpan<char> view of a value.</param> public ScalarBuilder With(AsSpan <TParams, char> asText) { asText.ThrowIfNull(nameof(asText)); _builder.Converters.Add(ValueBinder.Converter.Utf16Text(asText)); return(this); }