Permalink
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (26 sloc) 615 Bytes
// <Snippet2>
using System;
public class Temperature
{
private decimal temp;
public Temperature(decimal temperature)
{
this.temp = temperature;
}
public override string ToString()
{
return this.temp.ToString("N1") + "°C";
}
}
public class Example
{
public static void Main()
{
Temperature currentTemperature = new Temperature(23.6m);
Console.WriteLine("The current temperature is " +
currentTemperature.ToString());
}
}
// The example displays the following output:
// The current temperature is 23.6°C.
// </Snippet2>