Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colon use inside function declaration

Tags:

c#

I saw a code, where a colon was used inside a function declaration:

DoWork(Param1:Param2)

I know that a colon is for inheritance: class Child: Parent But, what is the purpose of the colon when it used before variable?

EDIT I've corrected the question

like image 478
LordTitiKaka Avatar asked Dec 04 '25 15:12

LordTitiKaka


1 Answers

Named optional arguments

Its so you can have an optional number of arguments supplied, but the compiler needs to know which arguments to marry up to which parameters, otherwise defaults will be used for the others.

like image 71
brumScouse Avatar answered Dec 07 '25 03:12

brumScouse