Convert number to String - CSharp System

CSharp examples for System:Converter

Description

Convert number to String

Demo Code


using System.Globalization;
using System.Drawing;
using System;/*ww w  .j av a2s . co m*/

public class Main{
        public static string ConvStr(this double val)
        {
            return val.ToString(CultureInfo.InvariantCulture);
        }
        public static string ConvStr(this int val)
        {
            return val.ToString(CultureInfo.InvariantCulture);
        }
        public static string ConvStr(this bool val)
        {
            return val.ToInt().ToString(CultureInfo.InvariantCulture);
        }
        public static int ToInt(this bool value)
        {
            return value ? 1 : 0;
        }
}

Related Tutorials