CSharp examples for Custom Type:Method Parameter
Use Optional Parameters
using System;//www . j ava 2s .c o m using System.Collections.Generic; using System.Linq; using System.Text; class MainClass { static void Main(string[] args) { printMessage(); printMessage("A"); printMessage("B", "G"); printMessage("J", "H", true); } static void printMessage(string from = "1", string message = "2", bool urgent = false) { Console.WriteLine("From: {0}, Urgent: {1}, Message: {2}", from, message, urgent); } }