[Feature] Address Feedback: Use value tuple (int, string) as the sorting key

This commit is contained in:
Dongbo Wang
2018-07-11 17:53:24 -07:00
parent add14e452f
commit d12230f188
2 changed files with 6 additions and 8 deletions
@@ -86,7 +86,7 @@ namespace System.Management.Automation
new ExperimentalFeature(name: "PSFileSystemProviderV2",
description: "Replace the old FileSystemProvider with cleaner design and faster code",
source: EngineSource,
isEnabled: false)),
isEnabled: false),
*/
};
EngineExperimentalFeatures = new ReadOnlyCollection<ExperimentalFeature>(engineFeatures);
@@ -58,15 +58,13 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
/// <remarks>
/// Engine features come before module features.
/// Within engine features and more features, features are ordered by name.
/// Within engine features and module features, features are ordered by name.
/// </remarks>
private static string GetSortingString(ExperimentalFeature feature)
private static (int, string) GetSortingString(ExperimentalFeature feature)
{
if (ExperimentalFeature.EngineSource.Equals(feature.Source))
{
return "0:" + feature.Name;
}
return "1:" + feature.Name;
return ExperimentalFeature.EngineSource.Equals(feature.Source, StringComparison.OrdinalIgnoreCase)
? (0, feature.Name)
: (1, feature.Name);
}
/// <summary>