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

IsPrimitiveArray() static private method

static private IsPrimitiveArray ( Type type, object &typeInformation ) : bool
type System.Type
typeInformation object
return bool
        internal static bool IsPrimitiveArray(Type type, out object typeInformation)
        {
            bool bIsPrimitive = true;

            if (ReferenceEquals(type, s_typeofBooleanArray)) typeInformation = InternalPrimitiveTypeE.Boolean;
            else if (ReferenceEquals(type, s_typeofByteArray)) typeInformation = InternalPrimitiveTypeE.Byte;
            else if (ReferenceEquals(type, s_typeofCharArray)) typeInformation = InternalPrimitiveTypeE.Char;
            else if (ReferenceEquals(type, s_typeofDoubleArray)) typeInformation = InternalPrimitiveTypeE.Double;
            else if (ReferenceEquals(type, s_typeofInt16Array)) typeInformation = InternalPrimitiveTypeE.Int16;
            else if (ReferenceEquals(type, s_typeofInt32Array)) typeInformation = InternalPrimitiveTypeE.Int32;
            else if (ReferenceEquals(type, s_typeofInt64Array)) typeInformation = InternalPrimitiveTypeE.Int64;
            else if (ReferenceEquals(type, s_typeofSByteArray)) typeInformation = InternalPrimitiveTypeE.SByte;
            else if (ReferenceEquals(type, s_typeofSingleArray)) typeInformation = InternalPrimitiveTypeE.Single;
            else if (ReferenceEquals(type, s_typeofUInt16Array)) typeInformation = InternalPrimitiveTypeE.UInt16;
            else if (ReferenceEquals(type, s_typeofUInt32Array)) typeInformation = InternalPrimitiveTypeE.UInt32;
            else if (ReferenceEquals(type, s_typeofUInt64Array)) typeInformation = InternalPrimitiveTypeE.UInt64;
            else
            {
                typeInformation = null;
                bIsPrimitive = false;
            }

            return bIsPrimitive;
        }

Usage Example

        // Token: 0x06005296 RID: 21142 RVA: 0x00121FEC File Offset: 0x001201EC
        internal static BinaryTypeEnum GetParserBinaryTypeInfo(Type type, out object typeInformation)
        {
            typeInformation = null;
            BinaryTypeEnum result;

            if (type == Converter.typeofString)
            {
                result = BinaryTypeEnum.String;
            }
            else if (type == Converter.typeofObject)
            {
                result = BinaryTypeEnum.Object;
            }
            else if (type == Converter.typeofObjectArray)
            {
                result = BinaryTypeEnum.ObjectArray;
            }
            else if (type == Converter.typeofStringArray)
            {
                result = BinaryTypeEnum.StringArray;
            }
            else if (Converter.IsPrimitiveArray(type, out typeInformation))
            {
                result = BinaryTypeEnum.PrimitiveArray;
            }
            else
            {
                InternalPrimitiveTypeE internalPrimitiveTypeE = Converter.ToCode(type);
                if (internalPrimitiveTypeE == InternalPrimitiveTypeE.Invalid)
                {
                    if (Assembly.GetAssembly(type) == Converter.urtAssembly)
                    {
                        result = BinaryTypeEnum.ObjectUrt;
                    }
                    else
                    {
                        result = BinaryTypeEnum.ObjectUser;
                    }
                    typeInformation = type.FullName;
                }
                else
                {
                    result          = BinaryTypeEnum.Primitive;
                    typeInformation = internalPrimitiveTypeE;
                }
            }
            return(result);
        }
All Usage Examples Of System.Runtime.Serialization.Formatters.Binary.Converter::IsPrimitiveArray