Composit Formatting
.toString can be used for the formatting the string but composit foramtting can be done through String.Format() method.
string str,str1;
str = String.Format("{0:C}", 189.99); //o/p:£189.99
string FormatString1 = String.Format("{0:dddd MMMM yyyy}", DateTime.Now); //Output:Firday January 2009
string myName = "ramya";
string sss= String.Format("Name = {0}, hours = {1:hh}, minutes = {1:mm}", myName, DateTime.Now);//Output: Name = Fred, hours = 04, minutes = 52
string myFName = "ramya";
string myLName = "krishna";
int myInt = 500;
string FormatFName = String.Format("First Name = {0,10}", myFName);//Output: First Name = ramya
string FormatLName = String.Format("Last Name = {0,10}", myLName);//output:Last Name = krishna
string FormatPrice = String.Format("Price = {0,10:C}", myInt);//output: Price = £500.00
Double price = 3.99;
string sample = String.Format("{0:c} on {1:d}", price, DateTime.Now)//output: £3.99 on 02/01/2009