コード例 #1
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public DateTimeOffsetToBytesConverter([CanBeNull] ConverterMappingHints mappingHints = null)
     : base(
         v => ToBytes(v),
         v => v == null ? default : FromBytes(v),
         _defaultHints.With(mappingHints))
 {
 }
コード例 #2
0
 /// <summary>
 ///     <para>
 ///         Creates a new instance of this converter.
 ///     </para>
 ///     <para>
 ///         This converter does not preserve order because the ordering of bits in
 ///         the standard binary representation of a GUID does not match the ordering
 ///         in the standard string representation.
 ///     </para>
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public GuidToBytesConverter([CanBeNull] ConverterMappingHints mappingHints = null)
     : base(
         v => v.ToByteArray(),
         v => v == null ? Guid.Empty : new Guid(v),
         _defaultHints.With(mappingHints))
 {
 }
コード例 #3
0
 /// <summary>
 ///     Creates a new instance of this converter. This converter preserves order.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public CharToStringConverter([CanBeNull] ConverterMappingHints mappingHints = null)
     : base(
         ToString(),
         ToChar(),
         _defaultHints.With(mappingHints))
 {
 }
コード例 #4
0
 /// <summary>
 ///     <para>
 ///         Creates a new instance of this converter.
 ///     </para>
 ///     <para>
 ///         This converter supports <see cref="double" />, <see cref="float" />, <see cref="decimal" />,
 ///         <see cref="int" />, <see cref="long" />, <see cref="short" />, <see cref="byte" />,
 ///         <see cref="uint" />, <see cref="ulong" />, <see cref="ushort" />, <see cref="sbyte" />,
 ///         and <see cref="char" />.
 ///     </para>
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public NumberToBytesConverter([CanBeNull] ConverterMappingHints mappingHints = null)
     : base(ToBytes(), ToNumber(), _defaultHints.With(mappingHints))
 {
 }