c# - Multiple optional parameters calling function -


assume have function below takes 3 parameters , 2 have optional values

private void  myfunc (int a, int b=2, int c=3) {   //do stuff here related a,b,c } 

now want call function below how possible ?

myfunc(3,,5) 

so want use default parameter b=2

but giving error way.

here error message

argument missing 

c# 4.5

you need use named parameters, so:

myfunc(a, c:5); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -