static public int ToInt32(string value)
{
try
{
return XmlConvert.ToInt32(value);
}
catch (ArgumentException exception)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "Int32", exception));
}
catch (FormatException exception)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "Int32", exception));
}
catch (OverflowException exception)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "Int32", exception));
}
}
XmlConverter::ToInt32 ( byte buffer, int offset, int count ) : int |
public int ToInt() { ValueHandleType type = _type; if (type == ValueHandleType.Zero) { return(0); } if (type == ValueHandleType.One) { return(1); } if (type == ValueHandleType.Int8) { return(GetInt8()); } if (type == ValueHandleType.Int16) { return(GetInt16()); } if (type == ValueHandleType.Int32) { return(GetInt32()); } if (type == ValueHandleType.Int64) { long value = GetInt64(); if (value >= int.MinValue && value <= int.MaxValue) { return((int)value); } } if (type == ValueHandleType.UInt64) { ulong value = GetUInt64(); if (value <= int.MaxValue) { return((int)value); } } if (type == ValueHandleType.UTF8) { return(XmlConverter.ToInt32(_bufferReader.Buffer, _offset, _length)); } return(XmlConverter.ToInt32(GetString())); }