internal object ReadContentAsAnyType(Type valueType)
{
switch (Type.GetTypeCode(valueType))
{
case TypeCode.Boolean:
return ReadContentAsBoolean();
case TypeCode.Char:
return ReadContentAsChar();
case TypeCode.Byte:
return ReadContentAsUnsignedByte();
case TypeCode.Int16:
return ReadContentAsShort();
case TypeCode.Int32:
return ReadContentAsInt();
case TypeCode.Int64:
return ReadContentAsLong();
case TypeCode.Single:
return ReadContentAsSingle();
case TypeCode.Double:
return ReadContentAsDouble();
case TypeCode.Decimal:
return ReadContentAsDecimal();
case TypeCode.DateTime:
return ReadContentAsDateTime();
case TypeCode.String:
return ReadContentAsString();
case TypeCode.SByte:
return ReadContentAsSignedByte();
case TypeCode.UInt16:
return ReadContentAsUnsignedShort();
case TypeCode.UInt32:
return ReadContentAsUnsignedInt();
case TypeCode.UInt64:
return ReadContentAsUnsignedLong();
case TypeCode.Empty:
case TypeCode.DBNull:
case TypeCode.Object:
default:
if (valueType == Globals.TypeOfByteArray)
return ReadContentAsBase64();
else if (valueType == Globals.TypeOfObject)
return new object();
else if (valueType == Globals.TypeOfTimeSpan)
return ReadContentAsTimeSpan();
else if (valueType == Globals.TypeOfGuid)
return ReadContentAsGuid();
else if (valueType == Globals.TypeOfUri)
return ReadContentAsUri();
else if (valueType == Globals.TypeOfXmlQualifiedName)
return ReadContentAsQName();
break;
}
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateInvalidPrimitiveTypeException(valueType));
}