static public ToSingle ( string value ) : float | ||
value | string | |
return | float |
static public float ToSingle(string value)
{
try
{
return XmlConvert.ToSingle(value);
}
catch (ArgumentException exception)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "float", exception));
}
catch (FormatException exception)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "float", exception));
}
catch (OverflowException exception)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "float", exception));
}
}
XmlConverter::ToSingle ( byte buffer, int offset, int count ) : float |
public float ToSingle() { switch (this.type) { case ValueHandleType.Single: return(this.GetSingle()); case ValueHandleType.Double: { double d = this.GetDouble(); if (((d >= -3.4028234663852886E+38) && (d <= 3.4028234663852886E+38)) || (double.IsInfinity(d) || double.IsNaN(d))) { return((float)d); } break; } case ValueHandleType.Zero: return(0f); case ValueHandleType.One: return(1f); case ValueHandleType.Int8: return((float)this.GetInt8()); case ValueHandleType.Int16: return((float)this.GetInt16()); case ValueHandleType.UTF8: return(XmlConverter.ToSingle(this.bufferReader.Buffer, this.offset, this.length)); } return(XmlConverter.ToSingle(this.GetString())); }