System.Runtime.Serialization.Formatters.Binary.Converter.ToCode C# (CSharp) Method

ToCode() static private method

static private ToCode ( Type type ) : InternalPrimitiveTypeE
type System.Type
return InternalPrimitiveTypeE
        internal static InternalPrimitiveTypeE ToCode(Type type) =>
                type == null ? ToPrimitiveTypeEnum(TypeCode.Empty) :
                type.IsPrimitive ? ToPrimitiveTypeEnum(Type.GetTypeCode(type)) :
                ReferenceEquals(type, s_typeofDateTime) ? InternalPrimitiveTypeE.DateTime :
                ReferenceEquals(type, s_typeofTimeSpan) ? InternalPrimitiveTypeE.TimeSpan :
                ReferenceEquals(type, s_typeofDecimal) ? InternalPrimitiveTypeE.Decimal :
                InternalPrimitiveTypeE.Invalid;

Usage Example

Beispiel #1
0
        internal InternalPrimitiveTypeE ToCode(Type type)
        {
            if (object.ReferenceEquals(this.previousType, type))
            {
                return(this.previousCode);
            }
            InternalPrimitiveTypeE ee = Converter.ToCode(type);

            if (ee != InternalPrimitiveTypeE.Invalid)
            {
                this.previousType = type;
                this.previousCode = ee;
            }
            return(ee);
        }
All Usage Examples Of System.Runtime.Serialization.Formatters.Binary.Converter::ToCode