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

ToArrayType() static private method

static private ToArrayType ( InternalPrimitiveTypeE code ) : Type
code InternalPrimitiveTypeE
return System.Type
        internal static Type ToArrayType(InternalPrimitiveTypeE code)
        {
            if (s_arrayTypeA == null)
            {
                InitArrayTypeA();
            }
            return s_arrayTypeA[(int)code];
        }

Usage Example

        internal static void TypeFromInfo(BinaryTypeEnum binaryTypeEnum, object typeInformation, ObjectReader objectReader, BinaryAssemblyInfo assemblyInfo, out InternalPrimitiveTypeE primitiveTypeEnum, out string typeString, out Type type, out bool isVariant)
        {
            isVariant         = false;
            primitiveTypeEnum = InternalPrimitiveTypeE.Invalid;
            typeString        = null;
            type = null;
            switch (binaryTypeEnum)
            {
            case BinaryTypeEnum.Primitive:
                primitiveTypeEnum = (InternalPrimitiveTypeE)typeInformation;
                typeString        = Converter.ToComType(primitiveTypeEnum);
                type = Converter.ToType(primitiveTypeEnum);
                return;

            case BinaryTypeEnum.String:
                type = Converter.typeofString;
                return;

            case BinaryTypeEnum.Object:
                type      = Converter.typeofObject;
                isVariant = true;
                return;

            case BinaryTypeEnum.ObjectUrt:
            case BinaryTypeEnum.ObjectUser:
                if (typeInformation != null)
                {
                    typeString = typeInformation.ToString();
                    type       = objectReader.GetType(assemblyInfo, typeString);
                    if (type == Converter.typeofObject)
                    {
                        isVariant = true;
                        return;
                    }
                }
                return;

            case BinaryTypeEnum.ObjectArray:
                type = Converter.typeofObjectArray;
                return;

            case BinaryTypeEnum.StringArray:
                type = Converter.typeofStringArray;
                return;

            case BinaryTypeEnum.PrimitiveArray:
                primitiveTypeEnum = (InternalPrimitiveTypeE)typeInformation;
                type = Converter.ToArrayType(primitiveTypeEnum);
                return;

            default:
                throw new SerializationException(Environment.GetResourceString("Serialization_TypeRead", new object[]
                {
                    binaryTypeEnum.ToString()
                }));
            }
        }
All Usage Examples Of System.Runtime.Serialization.Formatters.Binary.Converter::ToArrayType