Creating Methods that Use Optional Parameters

C Sharp > Creating Methods that Use Optional Parameters
18.10.2016 16:28:00


Наиболее часто встречающиеся слова в статье:

[forceStop] [StopService] [serviceName] [parameters] [Creating] [Methods] [Optional] [Parameters] [•Define] [mandatory]


Статья:

Creating Methods that Use Optional Parameters

•Define all mandatory parameters first

void StopService( bool forceStop, string serviceName = null, int serviceld =1)    ^

{

} 

•Satisfy parameters in sequence

var forceStop = true;

StopService(forceStop);

//OR

var forceStop = true;

var serviceName = "FourthCoffee.SalesService";

StopService(forceStop, serviceName);