e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
38 lines
1.6 KiB
C#
38 lines
1.6 KiB
C#
//------------------------------------------------------------------------------
|
|
// <copyright file="ConfigurationManagerHelperFactory.cs" company="Microsoft">
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace System.Configuration {
|
|
using System.Configuration.Internal;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Security.Permissions;
|
|
|
|
//
|
|
// class ConfigurationManagerHelperFactory manages access to a
|
|
// single instance of ConfigurationManagerHelper.
|
|
//
|
|
static internal class ConfigurationManagerHelperFactory {
|
|
private const string ConfigurationManagerHelperTypeString = "System.Configuration.Internal.ConfigurationManagerHelper, " + AssemblyRef.System;
|
|
|
|
static private volatile IConfigurationManagerHelper s_instance;
|
|
|
|
static internal IConfigurationManagerHelper Instance {
|
|
get {
|
|
if (s_instance == null) {
|
|
s_instance = CreateConfigurationManagerHelper();
|
|
}
|
|
|
|
return s_instance;
|
|
}
|
|
}
|
|
|
|
[ReflectionPermission(SecurityAction.Assert, Flags = ReflectionPermissionFlag.MemberAccess)]
|
|
[SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Justification = "Hard-coded to create an instance of a specific type.")]
|
|
private static IConfigurationManagerHelper CreateConfigurationManagerHelper() {
|
|
return TypeUtil.CreateInstance<IConfigurationManagerHelper>(ConfigurationManagerHelperTypeString);
|
|
}
|
|
}
|
|
}
|