Refactor MultipleServiceCommandBase.AllServices
(#15053)
This commit is contained in:
parent
8cc9b114b7
commit
b9f378d967
|
@ -290,28 +290,19 @@ namespace Microsoft.PowerShell.Commands
|
|||
#region Internal
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the master list of all services.
|
||||
/// Gets an array of all services.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
/// <value>
|
||||
/// An array of <see cref="ServiceController"/> components that represents all the service resources.
|
||||
/// </value>
|
||||
/// <exception cref="System.Security.SecurityException">
|
||||
/// MSDN does not document the list of exceptions,
|
||||
/// but it is reasonable to expect that SecurityException is
|
||||
/// among them. Errors here will terminate the cmdlet.
|
||||
/// </exception>
|
||||
internal ServiceController[] AllServices
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_allServices == null)
|
||||
{
|
||||
_allServices = ServiceController.GetServices();
|
||||
}
|
||||
internal ServiceController[] AllServices => _allServices ??= ServiceController.GetServices();
|
||||
|
||||
return _allServices;
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceController[] _allServices = null;
|
||||
private ServiceController[] _allServices;
|
||||
|
||||
internal ServiceController GetOneService(string nameOfService)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue