System.Runtime.Serialization.Formatters.Binary.BinaryTypeConverter.GetParserBinaryTypeInfo C# (CSharp) Method

GetParserBinaryTypeInfo() static private method

static private GetParserBinaryTypeInfo ( Type type, object &typeInformation ) : BinaryTypeEnum
type Type
typeInformation object
return BinaryTypeEnum
        internal static BinaryTypeEnum GetParserBinaryTypeInfo(Type type, out object typeInformation)
        {
            BinaryTypeEnum binaryTypeEnum;
            typeInformation = null;

            if (ReferenceEquals(type, Converter.s_typeofString))
            {
                binaryTypeEnum = BinaryTypeEnum.String;
            }
            else if (ReferenceEquals(type, Converter.s_typeofObject))
            {
                binaryTypeEnum = BinaryTypeEnum.Object;
            }
            else if (ReferenceEquals(type, Converter.s_typeofObjectArray))
            {
                binaryTypeEnum = BinaryTypeEnum.ObjectArray;
            }
            else if (ReferenceEquals(type, Converter.s_typeofStringArray))
            {
                binaryTypeEnum = BinaryTypeEnum.StringArray;
            }
            else if (Converter.IsPrimitiveArray(type, out typeInformation))
            {
                binaryTypeEnum = BinaryTypeEnum.PrimitiveArray;
            }
            else
            {
                InternalPrimitiveTypeE primitiveTypeEnum = Converter.ToCode(type);
                switch (primitiveTypeEnum)
                {
                    case InternalPrimitiveTypeE.Invalid:
                        binaryTypeEnum = type.Assembly == Converter.s_urtAssembly ?
                            BinaryTypeEnum.ObjectUrt :
                            BinaryTypeEnum.ObjectUser;
                        typeInformation = type.FullName;
                        break;
                    default:
                        binaryTypeEnum = BinaryTypeEnum.Primitive;
                        typeInformation = primitiveTypeEnum;
                        break;
                }
            }

            return binaryTypeEnum;
        }