ToArrayType() 정적인 개인적인 메소드

static private ToArrayType ( InternalPrimitiveTypeE code ) : Type
code InternalPrimitiveTypeE
리턴 System.Type
        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()
                }));
            }
        }
예제 #2
0
        // Given the wire type information, returns the actual type and additional information
        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);
                break;

            case BinaryTypeEnum.String:
                type = Converter.s_typeofString;
                break;

            case BinaryTypeEnum.Object:
                type      = Converter.s_typeofObject;
                isVariant = true;
                break;

            case BinaryTypeEnum.ObjectArray:
                type = Converter.s_typeofObjectArray;
                break;

            case BinaryTypeEnum.StringArray:
                type = Converter.s_typeofStringArray;
                break;

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

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

            default:
                throw new SerializationException(SR.Format(SR.Serialization_TypeRead, binaryTypeEnum.ToString()));
            }
        }