Numeric Format Strings:R

LetterMeaning
RRound-trip

using System;
using System.Text;
using System.Globalization;
class Sample
{
    public static void Main()
    {
        Console.WriteLine("{0:R}", 1f / 3f);
    }
}

The output:


0.333333343

For the float and double types.

R squeezes out all digits to ensure ex- act round-tripping.

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.