diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index 1d793857c..82210f627 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -290,28 +290,19 @@ namespace Microsoft.PowerShell.Commands #region Internal /// - /// Retrieve the master list of all services. + /// Gets an array of all services. /// - /// + /// + /// An array of components that represents all the service resources. + /// /// /// 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. /// - 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) {