Creating Methods that Use Output Parameters

C Sharp > Creating Methods that Use Output Parameters
18.10.2016 16:21:16


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

[statusMessage] [lsServiceOnline] [Creating] [Methods] [Parameters] [the out keyword] [parameter] [serviceName] [Provide] [variable]


Статья:

Creating Methods that Use Output Parameters

• Use the out keyword to define an output parameter

bool lsServiceOnline(string serviceName, out string statusMessage)

{

....

}

• Provide a variable for the corresponding argument when you call the method

var statusMessage = string.Empty; var isServiceOnline = lsServiceOnline(

"FourthCoffee.SalesService", out statusMessage);