CSharp examples for Custom Type:overload
Provide variations of the same methods, some with default arguments, by overloading the method name.
using System;/*from w w w . j av a 2 s . c om*/ public class Program { public static void Main(string[] args) { Console.WriteLine(DisplayRoundedDecimal(12.345678M, 3)); } public static string DisplayRoundedDecimal(decimal value, int numberOfSignificantDigits) { decimal roundedValue = decimal.Round(value,numberOfSignificantDigits); string s = Convert.ToString(roundedValue); return s; } public static string DisplayRoundedDecimal(decimal value) { string s = DisplayRoundedDecimal(value, 2); return s; } }