From 2fbda4e62bc5bf382858d4ac2d8aa6e41ea77581 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 20 Dec 2018 22:56:05 -0800 Subject: [PATCH] The static keyword should be right after access modifier (#8506) --- .../CimSessionOperations.cs | 4 ++-- .../WindowsTaskbarJumpList/ComInterfaces.cs | 2 +- .../WindowsTaskbarJumpList/PropVariant.cs | 2 +- .../security/AclCommands.cs | 2 +- .../security/CertificateProvider.cs | 10 +++++----- src/Microsoft.WSMan.Management/WsManHelper.cs | 6 +++--- .../CoreCLR/CorePsAssemblyLoadContext.cs | 2 +- .../engine/LanguagePrimitives.cs | 2 +- .../engine/Modules/ModuleIntrinsics.cs | 2 +- .../engine/Modules/ModuleUtils.cs | 4 ++-- .../engine/NativeCommandParameterBinder.cs | 2 +- src/System.Management.Automation/engine/Utils.cs | 12 ++++++------ .../engine/parser/SafeValues.cs | 2 +- .../common/WireDataFormat/RemotingDataObject.cs | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs index bdc22c965d..c020ab6d5b 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs @@ -781,7 +781,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// can running parallelly under more than one runspace(s). /// /// - static internal ConcurrentDictionary cimSessions + internal static ConcurrentDictionary cimSessions = new ConcurrentDictionary(); /// @@ -789,7 +789,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// Default runspace id /// /// - static internal Guid defaultRunspaceId = Guid.Empty; + internal static Guid defaultRunspaceId = Guid.Empty; /// /// diff --git a/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs b/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs index 6bf0b990ea..f4596b5b6a 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs @@ -235,7 +235,7 @@ namespace Microsoft.PowerShell } [DllImport("ole32.Dll")] - static internal extern HResult CoCreateInstance(ref Guid clsid, + internal static extern HResult CoCreateInstance(ref Guid clsid, [MarshalAs(UnmanagedType.IUnknown)] object inner, uint context, ref Guid uuid, diff --git a/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/PropVariant.cs b/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/PropVariant.cs index 56d5f71673..614d4e92ab 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/PropVariant.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/PropVariant.cs @@ -61,7 +61,7 @@ namespace Microsoft.PowerShell private class PropVariantNativeMethods { [DllImport("Ole32.dll", PreserveSig = false)] - internal extern static void PropVariantClear([In, Out] PropVariant pvar); + internal static extern void PropVariantClear([In, Out] PropVariant pvar); } } } diff --git a/src/Microsoft.PowerShell.Security/security/AclCommands.cs b/src/Microsoft.PowerShell.Security/security/AclCommands.cs index 46a2ea195d..a6168fb258 100644 --- a/src/Microsoft.PowerShell.Security/security/AclCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/AclCommands.cs @@ -110,7 +110,7 @@ namespace Microsoft.PowerShell.Commands /// Add brokered properties for easy access to important properties /// of security descriptor /// - static internal void AddBrokeredProperties( + internal static void AddBrokeredProperties( Collection results, bool audit, bool allCentralAccessPolicies) diff --git a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs index fd7c49e3ec..a4286cb595 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs @@ -1355,7 +1355,7 @@ namespace Microsoft.PowerShell.Commands } } - static private string EnsureDriveIsRooted(string path) + private static string EnsureDriveIsRooted(string path) { string result = path; @@ -1380,7 +1380,7 @@ namespace Microsoft.PowerShell.Commands return result; } - static private ErrorRecord CreateErrorRecord(string path, + private static ErrorRecord CreateErrorRecord(string path, CertificateProviderItem itemType) { Exception e = null; @@ -1491,7 +1491,7 @@ namespace Microsoft.PowerShell.Commands ThrowTerminatingError(er); } - static private string NormalizePath(string path) + private static string NormalizePath(string path) { if (path.Length > 0) { @@ -1510,7 +1510,7 @@ namespace Microsoft.PowerShell.Commands return path; } - static private string[] GetPathElements(string path) + private static string[] GetPathElements(string path) { string[] allElts = path.Split(s_pathSeparators); string[] result = null; @@ -3068,7 +3068,7 @@ namespace Microsoft.PowerShell.Commands } private static readonly char[] s_separators = new char[] { '/', '\\' }; - static private string[] GetPathElements(string path) + private static string[] GetPathElements(string path) { string[] allElts = path.Split(s_separators); string[] result = null; diff --git a/src/Microsoft.WSMan.Management/WsManHelper.cs b/src/Microsoft.WSMan.Management/WsManHelper.cs index 2ccd09abc6..fe6e1e4373 100644 --- a/src/Microsoft.WSMan.Management/WsManHelper.cs +++ b/src/Microsoft.WSMan.Management/WsManHelper.cs @@ -157,7 +157,7 @@ namespace Microsoft.WSMan.Management return _resourceMgr.GetString(rscname); } - static internal string FormatResourceMsgFromResourcetextS(string rscname, + internal static string FormatResourceMsgFromResourcetextS(string rscname, params object[] args) { return FormatResourceMsgFromResourcetextS(_resourceMgr, rscname, args); @@ -169,7 +169,7 @@ namespace Microsoft.WSMan.Management return FormatResourceMsgFromResourcetextS(_resourceMgr, resourceName, args); } - static private string FormatResourceMsgFromResourcetextS( + private static string FormatResourceMsgFromResourcetextS( ResourceManager resourceManager, string resourceName, object[] args) @@ -605,7 +605,7 @@ namespace Microsoft.WSMan.Management /// /// If there is ambiguity as specified above. /// - static internal void ValidateSpecifiedAuthentication(AuthenticationMechanism authentication, PSCredential credential, string certificateThumbprint) + internal static void ValidateSpecifiedAuthentication(AuthenticationMechanism authentication, PSCredential credential, string certificateThumbprint) { if ((credential != null) && (certificateThumbprint != null)) { diff --git a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs index f03bd0bf3e..b38c8349f2 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs @@ -100,7 +100,7 @@ namespace System.Management.Automation #region Fields - private readonly static object s_syncObj = new object(); + private static readonly object s_syncObj = new object(); private readonly string[] _probingPaths; private readonly string[] _extensions = new string[] { ".ni.dll", ".dll" }; // CoreCLR type catalog dictionary diff --git a/src/System.Management.Automation/engine/LanguagePrimitives.cs b/src/System.Management.Automation/engine/LanguagePrimitives.cs index b869a845f9..aa545f6add 100644 --- a/src/System.Management.Automation/engine/LanguagePrimitives.cs +++ b/src/System.Management.Automation/engine/LanguagePrimitives.cs @@ -583,7 +583,7 @@ namespace System.Management.Automation /// first object /// object to compare first to /// true if first is equal to the second - public new static bool Equals(object first, object second) + public static new bool Equals(object first, object second) { return Equals(first, second, false, CultureInfo.InvariantCulture); } diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 0529120e42..72a15563bd 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -1459,7 +1459,7 @@ namespace System.Management.Automation /// Removes all functions not belonging to the parent module. /// /// Parent module - static internal void RemoveNestedModuleFunctions(PSModuleInfo module) + internal static void RemoveNestedModuleFunctions(PSModuleInfo module) { var input = module.SessionState?.Internal?.ExportedFunctions; if ((input == null) || (input.Count == 0)) diff --git a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs index 51153100ec..d8f8e89a12 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs @@ -14,14 +14,14 @@ namespace System.Management.Automation.Internal // Default option for local file system enumeration: // - Ignore files/directories when access is denied; // - Search top directory only. - private readonly static System.IO.EnumerationOptions s_defaultEnumerationOptions = + private static readonly System.IO.EnumerationOptions s_defaultEnumerationOptions = new System.IO.EnumerationOptions() { AttributesToSkip = 0 }; // Default option for UNC path enumeration. Same as above plus a large buffer size. // For network shares, a large buffer may result in better performance as more results can be batched over the wire. // The buffer size 16K is recommended in the comment of the 'BufferSize' property: // "A "large" buffer, for example, would be 16K. Typical is 4K." - private readonly static System.IO.EnumerationOptions s_uncPathEnumerationOptions = + private static readonly System.IO.EnumerationOptions s_uncPathEnumerationOptions = new System.IO.EnumerationOptions() { AttributesToSkip = 0, BufferSize = 16384 }; /// diff --git a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs index ba99d3ccd3..c3bec0c0e2 100644 --- a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs +++ b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs @@ -347,7 +347,7 @@ namespace System.Management.Automation return needQuotes; } - static private string GetEnumerableArgSeparator(ArrayLiteralAst arrayLiteralAst, int index) + private static string GetEnumerableArgSeparator(ArrayLiteralAst arrayLiteralAst, int index) { if (arrayLiteralAst == null) return " "; diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 5a1201fb68..c0d9bde14b 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -490,10 +490,10 @@ namespace System.Management.Automation /// internal static string ModuleDirectory = Path.Combine(ProductNameForDirectory, "Modules"); - internal readonly static ConfigScope[] SystemWideOnlyConfig = new[] { ConfigScope.AllUsers }; - internal readonly static ConfigScope[] CurrentUserOnlyConfig = new[] { ConfigScope.CurrentUser }; - internal readonly static ConfigScope[] SystemWideThenCurrentUserConfig = new[] { ConfigScope.AllUsers, ConfigScope.CurrentUser }; - internal readonly static ConfigScope[] CurrentUserThenSystemWideConfig = new[] { ConfigScope.CurrentUser, ConfigScope.AllUsers }; + internal static readonly ConfigScope[] SystemWideOnlyConfig = new[] { ConfigScope.AllUsers }; + internal static readonly ConfigScope[] CurrentUserOnlyConfig = new[] { ConfigScope.CurrentUser }; + internal static readonly ConfigScope[] SystemWideThenCurrentUserConfig = new[] { ConfigScope.AllUsers, ConfigScope.CurrentUser }; + internal static readonly ConfigScope[] CurrentUserThenSystemWideConfig = new[] { ConfigScope.CurrentUser, ConfigScope.AllUsers }; internal static T GetPolicySetting(ConfigScope[] preferenceOrder) where T : PolicyBase, new() { @@ -508,7 +508,7 @@ namespace System.Management.Automation return policy; } - private readonly static ConcurrentDictionary s_cachedPoliciesFromConfigFile = + private static readonly ConcurrentDictionary s_cachedPoliciesFromConfigFile = new ConcurrentDictionary(); /// @@ -564,7 +564,7 @@ namespace System.Management.Automation {nameof(UpdatableHelp), @"Software\Policies\Microsoft\PowerShellCore\UpdatableHelp"}, {nameof(ConsoleSessionConfiguration), @"Software\Policies\Microsoft\PowerShellCore\ConsoleSessionConfiguration"} }; - private readonly static ConcurrentDictionary, PolicyBase> s_cachedPoliciesFromRegistry = + private static readonly ConcurrentDictionary, PolicyBase> s_cachedPoliciesFromRegistry = new ConcurrentDictionary, PolicyBase>(); /// diff --git a/src/System.Management.Automation/engine/parser/SafeValues.cs b/src/System.Management.Automation/engine/parser/SafeValues.cs index 0e4e4c0dcb..f4636315ec 100644 --- a/src/System.Management.Automation/engine/parser/SafeValues.cs +++ b/src/System.Management.Automation/engine/parser/SafeValues.cs @@ -59,7 +59,7 @@ namespace System.Management.Automation.Language } // A readonly singleton with the default SafeValueContext. - internal readonly static IsSafeValueVisitor Default = new IsSafeValueVisitor(GetSafeValueVisitor.SafeValueContext.Default); + internal static readonly IsSafeValueVisitor Default = new IsSafeValueVisitor(GetSafeValueVisitor.SafeValueContext.Default); // This is a check of the number of visits private uint _visitCount = 0; diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemotingDataObject.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemotingDataObject.cs index bf63f4d850..49d07c1b8c 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemotingDataObject.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemotingDataObject.cs @@ -293,7 +293,7 @@ namespace System.Management.Automation.Remoting /// /// /// - internal new static RemoteDataObject CreateFrom(RemotingDestination destination, + internal static new RemoteDataObject CreateFrom(RemotingDestination destination, RemotingDataType dataType, Guid runspacePoolId, Guid powerShellId,