1
{0:F2} means format what's in the first placeholder to 2 decimal places. So, if 'C' were 100, then it would format it as '100.00'.
{0} {1} means print what's in the first placeholder, followed by a space, followed by what's in the second placeholder. As you're only printing one number here, this would not be applicable.
Accepted 0
Hi,
Vulpes explained in the nice way.
Like this while(true)
{
}
you can use the following statement to infinite loop
for(;;)
{
}
0
Aditya, It seems you are not accepting the thread as Answer that helped you to resolve your problem. Its not a good practice, here we all are spending our time to help you. So Mark the thread as Answer, if it got resolved, so others can also get help from it.
0
Vulpes, nice explanation..
0
What is the meaning of this block {0:F2} in the above code because Generally we use {0} {1} like this to print the values in WriteLine Method
Why not the General one's cannot be worked out here in this example
0
Just change the Main() method to the following:
static void Main(string[] args)
{
while(true) // loops indefinitely
{
Console.WriteLine("Select the Conversion Direction");
Console.WriteLine("1.Celsius to FahrenHeit");
Console.WriteLine("2.FahrenHeit to Celsius");
Console.WriteLine("3.Exit application"); // need an exit route now
Console.Write("You selected :");
double F, C = 0;
string selection = Console.ReadLine();
Console.WriteLine();
switch (selection)
{
case "1":
Console.WriteLine("PLease Enter Celsius Temperature");
F = TempConverter.CelsiusToFahrenheit(Console.ReadLine());
Console.WriteLine("Temperature in FahrenHeit is {0:F2}",F); break;
case "2":
Console.WriteLine("PLease Enter FahrenHiet Temperature");
C = TempConverter.FahrenheitToCelsius(Console.ReadLine());
Console.WriteLine("Temperature in Celsius is {0:F2}",C); break;
case "3":
return; // returns from Main method and so exits application
default:
Console.WriteLine("Please Select the Convertor");break;
}
Console.WriteLine();
}
}

0
Now what my problem is after entering the celsius temperature the console quits the application whereas what i want is if any conversion or Viceversa is done even after it should return back to the console to take another conversion in the same console without rebuidling the application
Please Find me a solution.........................
0
You appear to have uploaded the wrong file.
The file you've uploaded is called EmpTax.cs, not TempConverter.cs.