Search Results for

    Show / Hide Table of Contents

    Class SerializationHintsAttribute

    Provides hints to the binary serializer on how to improve serialization and decrease the size of the serialialized representation.

    Inheritance
    object
    Attribute
    SerializationHintsAttribute
    Implements
    _Attribute
    Inherited Members
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.Equals(object)
    Attribute.GetHashCode()
    Attribute.Match(object)
    Attribute.IsDefaultAttribute()
    Attribute.TypeId
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: System.Runtime.Serialization
    Assembly: nanoFramework.Serialization.Helper.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class|AttributeTargets.Property|AttributeTargets.Field, Inherited = true)]
    public class SerializationHintsAttribute : Attribute, _Attribute

    Constructors

    SerializationHintsAttribute()

    Declaration
    public SerializationHintsAttribute()

    Fields

    ArraySize

    Specifies the size of an array.

    Declaration
    public int ArraySize
    Field Value
    Type Description
    int
    Remarks

    If an array's size is fixed and known, it can be stated using the ArraySize option. A value of -1 can be used if the class being serialized only has one array of simple data types and no other fields.

    BitPacked

    Specifies the number of bits in which the current object is bit-packed.

    Declaration
    public int BitPacked
    Field Value
    Type Description
    int
    Remarks

    This can be applied only to ordinal types, DateTime and TimeSpan. This indicates how many bits should be kept for an ordinal type. If BitPacked is 0, a data type's default size is applied (for example, 2 bytes for an short and 1 byte for the byte type). Decorating a bool field with BitPacked attribute set to 1, only one bit - which is enough to represent true or false - is kept for the bool value.

    Options

    Serialization options for the current object.

    Declaration
    public SerializationOptions Options
    Field Value
    Type Description
    SerializationOptions

    RangeBias

    Specifies the range bias adjustment for a particular serialized value.

    Declaration
    public long RangeBias
    Field Value
    Type Description
    long
    Remarks

    This can be applied to ordinal types, DateTime and TimeSpan. It can't be applied to bool type objects. With the exception of bool, all ordinal types can use RangeBias. It allows to store a value using fewer bits. Before saving the ordinal value, the range bias value is subtracted from it. For instance, a 16 bit data type has to used to store values that range between 1000 and 1500. The required bits can be decreased from 16 to 6 if the range is known in advance. When RangeBias is set to 1000, the number 1000 is subtracted from the original value before it's serialized.

    Scale

    Specifies the range bias adjustment for a particular serialized value.

    Declaration
    public ulong Scale
    Field Value
    Type Description
    ulong
    Remarks

    This can be applied to ordinal types, DateTime and TimeSpan. It can't be applied to bool type objects. When serializing a value, Scale helps save storage bits similar to RangeBias. The value to be serialized is divided by Scale. Defining a Scale of two, the range of values can be cut in half if a field only contains odd or even values. It's also possible to combine RangeBias with Scale. However, the order of operations must be taken into account here. The value will be first subtracted by RangeBias and then divided by Scale.

    Implements

    System.Runtime.InteropServices._Attribute

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    In This Article
    Back to top Copyright © 2023 nanoFramework Contributors
    Generated by DocFX