From: nicol on 13 Jun 2010 03:31 On Jun 13, 11:05 am, "Zach" <x...(a)yy.zz> wrote: > X.ToString(); gives a string representation of X > Say you have int Y = 3; > Then you cannot show Y in a textbox unless you first convert Y to a string > by means of Y.ToSyring(); > There are things you can put inbetween the brackets. > > In EN-US Culture > double arg = 123,456,789.00 > Console.WriteLine(arg.ToString("C"));$123,456,789.00 > Console.WriteLine(arg.ToString("E")); 1.234568E+008 > Console.WriteLine(arg.ToString("P")); 12,345,678,900.00% > Console.WriteLine(arg.ToString("N")); 123,456,789.00 > Console.WriteLine(arg.ToString("F")); 123456789.00 > > "nicol" <nicol.youn...(a)gmail.com> wrote in message > > news:e799ab0b-d591-4ab5-b876-dd200792b68e(a)h13g2000yqm.googlegroups.com... > > > hi > > i know ToString is one of methods in object class . & i use it in my > > program but i want to show it results when i run program(show it on > > screen) > > > using System; > > > namespace inheritance_2 > > { > > class Program > > { > > static void Main(string[] args) > > { > > point a = new point(3, 7); > > a.ToString(); //*********** > > } > > } > > } > > public class point > > { > > protected int x, y; > > public point() > > { > > } > > public point(int xvalue, int yvalue) > > { > > x = xvalue; > > y = yvalue; > > } > > public override string ToString() > > { > > //return base.ToString(); > > return "[" + x + "," + y + "]"; // whant to show this > > result > > } > > } // end class point > > > and i want to know what is the usage of ToString > > thanks thanks i think i get what u mean |