Bug Description
ResourceHelper initializes an empty list and then conditionally reassigns it inside an if block. A single ternary expression is cleaner.
Actual Behavior
// ResourceHelper.cs lines 56-61
var runningServices = new List<string>();
if (stopServices)
{
runningServices = isCli
? _serviceHelper.GetRunningServyCLIServices()
: _serviceHelper.GetRunningServyUIServices();
}
The initial new List<string>() allocation is wasted when stopServices is true.
Suggested Fix
var runningServices = stopServices
? (isCli ? _serviceHelper.GetRunningServyCLIServices() : _serviceHelper.GetRunningServyUIServices())
: new List<string>();
Environment
- File:
src/Servy.Core/Helpers/ResourceHelper.cs
- Lines: 56-61
Bug Description
ResourceHelperinitializes an empty list and then conditionally reassigns it inside anifblock. A single ternary expression is cleaner.Actual Behavior
The initial
new List<string>()allocation is wasted whenstopServicesis true.Suggested Fix
Environment
src/Servy.Core/Helpers/ResourceHelper.cs