martes, 14 de agosto de 2012

Decimal Number Formatting

Well I can't explain why but we kept losing decimal places when converting a real to a string.  The below function does *not* truncate the real value to two decimal places.  Note that the function is located in a utility class, and will execute on the server.
public static server str getExchRateCalc(real _fixedExchRate)
{
;
    new InteropPermission(InteropKind::ClrInterop).assert();
    return System.String::Format("{0,0:G}",(_fixedExchRate));
}

No hay comentarios:

Publicar un comentario