6
Answers

optional parameter write methods

Hemant Sharma

Hemant Sharma

10y
840
1
Hi all i am a absolute beginner of c#5.0 and i want to understand how the Console.Writeline is different for optional parameters e.g

class test
{
static void Prg(int a=0,int b=0,int c=0,int d=0)
{Console.Writeline(a,b,c,d);}
static void Main()
{
Prg();
}

i want to print values for a,b,c,d as 0 0 0 0 in o/p

but iit shows error as 'overload method has some invalid arguments.

tell me methods for Console.Write() for this code,thanks in advance.
Answers (6)