Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit dc2678b

Browse files
author
Rodrigo Moya
committed
[FeatureSwitchService] Replace lazy initialization with static
1 parent 7c17da3 commit dc2678b

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

main/src/core/MonoDevelop.Core/MonoDevelop.Core.FeatureConfiguration/FeatureSwitchService.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,9 @@ namespace MonoDevelop.Core.FeatureConfiguration
3636
public static class FeatureSwitchService
3737
{
3838
static Dictionary<string, FeatureSwitch> featureSwitches = new Dictionary<string, FeatureSwitch> ();
39-
static bool initialized = false;
4039

41-
static void EnsureInitialized ()
40+
static FeatureSwitchService ()
4241
{
43-
if (initialized)
44-
return;
45-
46-
initialized = true;
4742
AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Core/FeatureSwitches", HandleFeatureSwitchExtension);
4843
}
4944

@@ -61,8 +56,6 @@ static void HandleFeatureSwitchExtension (object sender, ExtensionNodeEventArgs
6156

6257
public static bool? IsFeatureEnabled (string featureName)
6358
{
64-
EnsureInitialized ();
65-
6659
if (string.IsNullOrEmpty (featureName)) {
6760
return null;
6861
}
@@ -119,7 +112,6 @@ internal static void SetFeatureSwitchValue (string id, bool? value)
119112

120113
internal static IEnumerable<FeatureSwitch> DescribeFeatures ()
121114
{
122-
EnsureInitialized ();
123115
return featureSwitches.Values;
124116
}
125117

0 commit comments

Comments
 (0)