From dfd2f6936922856d1c9bc0e0061763325ba8c159 Mon Sep 17 00:00:00 2001 From: Ilya Date: Mon, 31 Dec 2018 20:44:16 +0500 Subject: [PATCH] Style: Change 'String.' to 'string.' (#8568) --- .../CimCmdletModuleInitialize.cs | 2 +- .../CimCommandBase.cs | 6 +- .../CimGetInstance.cs | 4 +- .../CimInvokeCimMethod.cs | 4 +- .../CimRegisterCimIndication.cs | 2 +- .../CimResultObserver.cs | 2 +- .../CimSessionOperations.cs | 12 +- .../CimSessionProxy.cs | 8 +- .../CimSetCimInstance.cs | 4 +- .../CmdletOperation.cs | 4 +- .../NewCimSessionOptionCommand.cs | 2 +- .../RegisterCimIndicationCommand.cs | 2 +- .../Utils.cs | 12 +- .../CommonUtils.cs | 2 +- .../management/ClearRecycleBinCommand.cs | 14 +- .../commands/management/Computer.cs | 4 +- .../commands/management/ContentCommandBase.cs | 4 +- .../commands/management/GetChildrenCommand.cs | 4 +- .../management/GetClipboardCommand.cs | 4 +- .../management/GetWMIObjectCommand.cs | 10 +- .../management/MovePropertyCommand.cs | 2 +- .../commands/management/Navigation.cs | 14 +- .../commands/management/ParsePathCommand.cs | 6 +- .../commands/management/Process.cs | 8 +- .../management/RegisterWMIEventCommand.cs | 2 +- .../commands/management/Service.cs | 16 +- .../management/SetClipboardCommand.cs | 20 +-- .../commands/management/SetPropertyCommand.cs | 2 +- .../management/TestConnectionCommand.cs | 4 +- .../commands/management/WMIHelper.cs | 4 +- .../commands/utility/AddType.cs | 24 +-- .../commands/utility/CSVCommands.cs | 2 +- .../utility/ConvertFrom-SddlString.cs | 10 +- .../commands/utility/Csv.cs | 2 +- .../commands/utility/ExportAliasCommand.cs | 2 +- .../OutGridView/ExpressionColumnInfo.cs | 2 +- .../FormatAndOutput/format-hex/Format-Hex.cs | 4 +- .../commands/utility/GetDateCommand.cs | 10 +- .../commands/utility/GetEventCommand.cs | 2 +- .../utility/GetEventSubscriberCommand.cs | 2 +- .../commands/utility/GetMember.cs | 4 +- .../commands/utility/GetRandomCommand.cs | 2 +- .../commands/utility/GetUnique.cs | 2 +- .../utility/ImplicitRemotingCommands.cs | 4 +- .../commands/utility/Measure-Object.cs | 2 +- .../commands/utility/RemoveEventCommand.cs | 6 +- .../utility/ShowCommand/ShowCommand.cs | 8 +- .../ShowCommand/ShowCommandParameterType.cs | 8 +- .../commands/utility/UnblockFile.cs | 2 +- .../utility/UnregisterEventCommand.cs | 6 +- .../commands/utility/Update-TypeData.cs | 6 +- .../commands/utility/Var.cs | 4 +- .../Common/InvokeRestMethodCommand.Common.cs | 4 +- .../Common/WebRequestPSCmdlet.Common.cs | 20 +-- .../WebCmdlet/ConvertFromJsonCommand.cs | 2 +- .../commands/utility/WebCmdlet/PSUserAgent.cs | 2 +- .../commands/utility/WriteAliasCommandBase.cs | 2 +- .../commands/utility/XmlCommands.cs | 2 +- .../commands/utility/tee-object.cs | 4 +- .../utility/trace/TraceListenerCommandBase.cs | 2 +- .../host/msh/ConsoleControl.cs | 8 +- .../host/msh/ConsoleHost.cs | 2 +- .../host/msh/ConsoleHostRawUserInterface.cs | 4 +- .../host/msh/ConsoleHostTranscript.cs | 2 +- ...ConsoleHostUserInterfacePromptForChoice.cs | 4 +- .../host/msh/Executor.cs | 2 +- .../host/msh/Serialization.cs | 2 +- .../host/msh/StartTranscriptCmdlet.cs | 4 +- .../Eventing/EventProviderTraceListener.cs | 4 +- .../Eventing/Reader/ProviderMetadata.cs | 6 +- .../LocalAccounts/Native.cs | 4 +- .../LocalAccounts/Sam.cs | 2 +- .../ScheduledJobDefinition.cs | 4 +- .../security/CertificateProvider.cs | 72 ++++----- .../security/CmsCommands.cs | 28 ++-- .../security/ExecutionPolicyCommands.cs | 2 +- .../security/SecureStringCommands.cs | 2 +- .../security/SignatureCommands.cs | 6 +- .../ConfigProvider.cs | 138 +++++++++--------- .../CurrentConfigurations.cs | 2 +- src/Microsoft.WSMan.Management/PingWSMan.cs | 2 +- .../Set-QuickConfig.cs | 2 +- .../WSManInstance.cs | 6 +- src/Microsoft.WSMan.Management/WsManHelper.cs | 6 +- .../CoreCLR/CorePsPlatform.cs | 2 +- .../DscSupport/CimDSCParser.cs | 18 +-- .../FormatAndOutput/common/ComplexWriter.cs | 4 +- .../common/DisplayDatabase/XmlLoaderBase.cs | 8 +- .../common/DisplayDatabase/commands.cs | 6 +- .../common/DisplayDatabase/typeDataQuery.cs | 2 +- .../common/FormatViewManager.cs | 4 +- .../common/Utilities/MshObjectUtil.cs | 6 +- ...lets-over-objects.xmlSerializer.autogen.cs | 2 +- .../engine/AliasInfo.cs | 4 +- .../engine/ApplicationInfo.cs | 4 +- .../engine/Attributes.cs | 2 +- .../engine/CmdletInfo.cs | 10 +- .../engine/CmdletParameterBinderController.cs | 16 +- .../engine/CodeMethods.cs | 6 +- .../engine/ComInterop/ComEventSink.cs | 4 +- .../engine/ComInterop/ComParamDesc.cs | 2 +- .../engine/ComInterop/ComTypeEnumDesc.cs | 2 +- .../engine/ComInterop/ComTypeLibDesc.cs | 4 +- .../engine/ComInterop/DispCallable.cs | 2 +- .../engine/ComInterop/IDispatchComObject.cs | 6 +- .../engine/ComInterop/Variant.cs | 2 +- .../CommandCompletion/CommandCompletion.cs | 6 +- .../CommandCompletion/CompletionAnalysis.cs | 20 +-- .../CommandCompletion/CompletionCompleters.cs | 20 +-- .../PseudoParameterBinder.cs | 2 +- .../engine/CommandDiscovery.cs | 14 +- .../engine/CommandInfo.cs | 2 +- .../engine/CommandMetadata.cs | 8 +- .../engine/CommandProcessorBase.cs | 4 +- .../engine/CommandSearcher.cs | 2 +- .../engine/CoreAdapter.cs | 4 +- .../engine/DataStoreAdapter.cs | 4 +- .../engine/DataStoreAdapterProvider.cs | 20 +-- .../engine/DscResourceInfo.cs | 2 +- .../engine/EnumExpressionEvaluator.cs | 6 +- .../engine/ErrorPackage.cs | 10 +- .../engine/EventManager.cs | 6 +- .../engine/ExecutionContext.cs | 6 +- .../engine/ExtendedTypeSystemException.cs | 14 +- .../engine/ExternalScriptInfo.cs | 4 +- .../engine/FunctionInfo.cs | 8 +- .../engine/GetCommandCommand.cs | 8 +- .../engine/InitialSessionState.cs | 24 +-- .../engine/InternalCommands.cs | 18 +-- .../engine/InvocationInfo.cs | 2 +- .../engine/LanguagePrimitives.cs | 6 +- .../engine/MergedCommandParameterMetadata.cs | 14 +- .../engine/Modules/ModuleCmdletBase.cs | 12 +- .../engine/Modules/ModuleIntrinsics.cs | 2 +- .../engine/Modules/ModuleSpecification.cs | 4 +- .../engine/Modules/ModuleUtils.cs | 4 +- .../Modules/NewModuleManifestCommand.cs | 8 +- .../engine/Modules/PSModuleInfo.cs | 10 +- .../engine/Modules/ScriptAnalysis.cs | 28 ++-- .../engine/MshCommandRuntime.cs | 24 +-- .../engine/MshObjectTypeDescriptor.cs | 2 +- .../engine/MshSnapinQualifiedName.cs | 2 +- .../engine/NativeCommandProcessor.cs | 2 +- .../engine/ObjectEventRegistrationBase.cs | 2 +- .../engine/PSClassInfo.cs | 2 +- .../engine/PSVersionInfo.cs | 10 +- .../engine/ParameterBinderBase.cs | 4 +- .../engine/ParameterInfo.cs | 4 +- .../engine/ParameterSetInfo.cs | 2 +- .../engine/ProgressRecord.cs | 2 +- .../engine/PseudoParameters.cs | 6 +- .../engine/ScopedItemSearcher.cs | 2 +- .../engine/ScriptCommandProcessor.cs | 2 +- .../engine/SessionState.cs | 2 +- .../engine/SessionStateAliasAPIs.cs | 2 +- .../engine/SessionStateContainer.cs | 30 ++-- .../engine/SessionStateDriveAPIs.cs | 12 +- .../engine/SessionStateLocationAPIs.cs | 12 +- .../engine/SessionStateNavigation.cs | 2 +- .../engine/SessionStateProviderAPIs.cs | 6 +- .../engine/SessionStateScopeAPIs.cs | 8 +- .../engine/ShellVariable.cs | 4 +- .../engine/TypeMetadata.cs | 2 +- .../engine/TypeTable.cs | 14 +- .../engine/Utils.cs | 14 +- .../engine/VariableInterfaces.cs | 2 +- .../engine/cmdlet.cs | 26 ++-- .../engine/debugger/debugger.cs | 2 +- .../engine/hostifaces/Command.cs | 2 +- .../engine/hostifaces/ConnectionBase.cs | 2 +- .../engine/hostifaces/HostUtilities.cs | 16 +- .../hostifaces/InternalHostUserInterface.cs | 2 +- .../engine/hostifaces/LocalConnection.cs | 2 +- .../engine/hostifaces/LocalPipeline.cs | 6 +- .../hostifaces/MshHostRawUserInterface.cs | 6 +- .../engine/hostifaces/MshHostUserInterface.cs | 18 +-- .../engine/interpreter/BranchLabel.cs | 2 +- .../engine/interpreter/LabelInfo.cs | 4 +- .../engine/interpreter/LightCompiler.cs | 6 +- .../engine/interpreter/LocalVariables.cs | 2 +- .../engine/interpreter/StackOperations.cs | 2 +- .../engine/lang/parserutils.cs | 12 +- .../engine/parser/Compiler.cs | 6 +- .../engine/parser/DebugViewWriter.cs | 24 +-- .../engine/parser/FusionAssemblyIdentity.cs | 2 +- .../engine/parser/PSType.cs | 6 +- .../engine/parser/Parser.cs | 12 +- .../engine/parser/Position.cs | 4 +- .../engine/parser/SafeValues.cs | 6 +- .../engine/parser/SemanticChecks.cs | 2 +- .../engine/parser/SymbolResolver.cs | 2 +- .../engine/parser/TypeResolver.cs | 2 +- .../engine/parser/ast.cs | 4 +- .../engine/parser/tokenizer.cs | 2 +- .../engine/regex.cs | 4 +- .../engine/remoting/client/Job.cs | 6 +- .../engine/remoting/client/Job2.cs | 2 +- .../engine/remoting/client/JobManager.cs | 4 +- .../remoting/client/JobSourceAdapter.cs | 2 +- .../engine/remoting/client/PSProxyJob.cs | 8 +- .../client/RemoteRunspacePoolInternal.cs | 2 +- .../engine/remoting/client/remoterunspace.cs | 4 +- .../client/remotingprotocolimplementation.cs | 2 +- .../remoting/commands/CustomShellCommands.cs | 4 +- .../commands/EnterPSHostProcessCommand.cs | 2 +- .../remoting/commands/InvokeCommandCommand.cs | 6 +- .../commands/NewPSSessionConfigurationFile.cs | 20 +-- .../remoting/commands/PSRemotingCmdlet.cs | 6 +- .../remoting/commands/PushRunspaceCommand.cs | 4 +- .../engine/remoting/commands/RemoveJob.cs | 2 +- .../remoting/commands/newrunspacecommand.cs | 6 +- .../common/RemoteSessionHyperVSocket.cs | 4 +- .../remoting/common/RunspaceConnectionInfo.cs | 10 +- .../engine/remoting/common/psstreamobject.cs | 2 +- .../fanin/InitialSessionStateProvider.cs | 26 ++-- .../fanin/OutOfProcTransportManager.cs | 2 +- .../fanin/PSSessionConfigurationData.cs | 2 +- .../engine/remoting/fanin/WSManNativeAPI.cs | 2 +- .../engine/remoting/fanin/WSManPlugin.cs | 22 +-- .../remoting/fanin/WSManPluginShellSession.cs | 8 +- .../engine/runtime/Binding/Binders.cs | 4 +- .../engine/runtime/CompiledScriptBlock.cs | 16 +- .../engine/runtime/MutableTuple.cs | 6 +- .../engine/runtime/Operations/MiscOps.cs | 2 +- .../engine/runtime/Operations/StringOps.cs | 8 +- .../help/CommandHelpProvider.cs | 6 +- .../help/DefaultCommandHelpObjectBuilder.cs | 40 ++--- .../help/DscResourceHelpProvider.cs | 4 +- .../help/HelpUtils.cs | 2 +- .../help/MamlNode.cs | 8 +- .../help/PSClassHelpProvider.cs | 4 +- .../help/ProviderHelpProvider.cs | 4 +- .../help/UpdatableHelpCommandBase.cs | 2 +- .../help/UpdatableHelpInfo.cs | 4 +- .../help/UpdatableHelpSystem.cs | 14 +- .../logging/LogProvider.cs | 4 +- .../logging/MshLog.cs | 2 +- .../logging/eventlog/EventLogLogProvider.cs | 2 +- .../namespaces/AliasProvider.cs | 2 +- .../namespaces/EnvironmentProvider.cs | 2 +- .../namespaces/FileSystemProvider.cs | 116 +++++++-------- .../namespaces/FunctionProvider.cs | 2 +- .../namespaces/LocationGlobber.cs | 42 +++--- .../namespaces/NavigationProviderBase.cs | 26 ++-- .../namespaces/PathInfo.cs | 2 +- .../namespaces/ProviderBase.cs | 4 +- .../ProviderDeclarationAttribute.cs | 2 +- .../namespaces/RegistryProvider.cs | 54 +++---- .../namespaces/SessionStateProviderBase.cs | 14 +- .../namespaces/TransactedRegistryKey.cs | 12 +- .../namespaces/VariableProvider.cs | 4 +- .../namespaces/Win32Native.cs | 2 +- .../security/CatalogHelper.cs | 6 +- .../security/MshSignature.cs | 2 +- .../security/SecureStringHelper.cs | 2 +- .../security/SecurityManager.cs | 6 +- .../security/SecuritySupport.cs | 26 ++-- .../security/wldpNativeMethods.cs | 4 +- .../singleshell/config/MshSnapinInfo.cs | 10 +- .../config/MshSnapinLoadException.cs | 4 +- .../utils/ClrFacade.cs | 2 +- .../utils/CommandDiscoveryExceptions.cs | 4 +- .../utils/CryptoUtils.cs | 6 +- .../utils/ExecutionExceptions.cs | 2 +- .../utils/GraphicalHostReflectionWrapper.cs | 2 +- .../utils/MshTraceSource.cs | 2 +- .../utils/ParameterBinderExceptions.cs | 6 +- .../utils/PowerShellETWTracer.cs | 18 +-- .../utils/PowerShellExecutionHelper.cs | 4 +- .../utils/PsUtils.cs | 4 +- .../utils/SessionStateExceptions.cs | 6 +- .../utils/StringUtil.cs | 6 +- .../utils/StructuredTraceSource.cs | 12 +- .../utils/assert.cs | 2 +- .../perfCounters/CounterSetInstanceBase.cs | 14 +- .../utils/perfCounters/PSPerfCountersMgr.cs | 22 +-- .../WebListener/Controllers/GetController.cs | 6 +- .../WebListener/Controllers/LinkController.cs | 4 +- .../Controllers/MultipartController.cs | 4 +- .../Controllers/RedirectController.cs | 2 +- .../Controllers/ResponseController.cs | 6 +- .../Controllers/ResponseHeadersController.cs | 6 +- 282 files changed, 1102 insertions(+), 1102 deletions(-) diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs index 9dfd6aa10..21f339b1c 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs @@ -86,7 +86,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// internal string Value { get { return this._value; } } - private string _value = String.Empty; + private string _value = string.Empty; /// /// The string defining real cmdlet name diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs index ac9690468..e618f555a 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs @@ -903,7 +903,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets string parameterName, PasswordAuthenticationMechanism authentication) { - string message = String.Format(CultureInfo.CurrentUICulture, Strings.InvalidAuthenticationTypeWithNullCredential, + string message = string.Format(CultureInfo.CurrentUICulture, Strings.InvalidAuthenticationTypeWithNullCredential, authentication, ImpersonatedAuthenticationMechanism.None, ImpersonatedAuthenticationMechanism.Negotiate, @@ -925,7 +925,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets string parameterName, string conflictParameterName) { - string message = String.Format(CultureInfo.CurrentUICulture, + string message = string.Format(CultureInfo.CurrentUICulture, Strings.ConflictParameterWasSet, parameterName, conflictParameterName); PSArgumentException exception = new PSArgumentException(message, parameterName); @@ -955,7 +955,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets propList.Append(property); } - string message = String.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindPropertyFromGivenClass, + string message = string.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindPropertyFromGivenClass, className, propList); PSArgumentOutOfRangeException exception = new PSArgumentOutOfRangeException( parameterName, actualValue, message); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs index 36b9034fb..943ef1b56 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs @@ -322,8 +322,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } return (cmd.Filter == null) ? - String.Format(CultureInfo.CurrentUICulture, queryWithoutWhere, propertyList, cmd.ClassName) : - String.Format(CultureInfo.CurrentUICulture, queryWithWhere, propertyList, cmd.ClassName, cmd.Filter); + string.Format(CultureInfo.CurrentUICulture, queryWithoutWhere, propertyList, cmd.ClassName) : + string.Format(CultureInfo.CurrentUICulture, queryWithWhere, propertyList, cmd.ClassName, cmd.Filter); } return null; diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs index 9e42aa7f2..1feeef94d 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs @@ -391,7 +391,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets declaration = cimClass.CimClassMethods[methodName]; if (declaration == null) { - throw new ArgumentException(String.Format( + throw new ArgumentException(string.Format( CultureInfo.CurrentUICulture, Strings.InvalidMethod, methodName, className)); } } @@ -406,7 +406,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimMethodParameterDeclaration paramDeclaration = declaration.Parameters[parameterName]; if (paramDeclaration == null) { - throw new ArgumentException(String.Format( + throw new ArgumentException(string.Format( CultureInfo.CurrentUICulture, Strings.InvalidMethodParameter, parameterName, methodName, className)); } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs index 9daf761d0..7f53e5913 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs @@ -170,7 +170,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets DebugHelper.WriteLogEx("queryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression); if (cimSession == null) { - throw new ArgumentNullException(String.Format(CultureInfo.CurrentUICulture, Strings.NullArgument, @"cimSession")); + throw new ArgumentNullException(string.Format(CultureInfo.CurrentUICulture, Strings.NullArgument, @"cimSession")); } this.TargetComputerName = cimSession.ComputerName; diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimResultObserver.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimResultObserver.cs index 508e678ff..5006ebbca 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimResultObserver.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimResultObserver.cs @@ -474,7 +474,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { resultObject.Properties.Add(new PSNoteProperty(@"PSComputerName", this.CurrentSession.ComputerName)); resultObject.TypeNames.Insert(0, resultObjectPSType); - resultObject.TypeNames.Insert(0, String.Format(CultureInfo.InvariantCulture, PSTypeCimMethodResultTemplate, resultObjectPSType, ClassName, MethodName)); + resultObject.TypeNames.Insert(0, string.Format(CultureInfo.InvariantCulture, PSTypeCimMethodResultTemplate, resultObjectPSType, ClassName, MethodName)); base.OnNextCore(resultObject); } } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs index 40fb54ed6..3d301650e 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs @@ -431,12 +431,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// internal string GetRemoveSessionObjectTarget(PSObject psObject) { - String message = String.Empty; + String message = string.Empty; if (psObject.BaseObject is CimSession) { UInt32 id = 0x0; Guid instanceId = Guid.Empty; - String name = String.Empty; + String name = string.Empty; String computerName = string.Empty; if (psObject.Properties[idPropName].Value is UInt32) { @@ -458,7 +458,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets computerName = (String)psObject.Properties[computernamePropName].Value; } - message = String.Format(CultureInfo.CurrentUICulture, SessionObjectPath, id, instanceId, name, computerName); + message = string.Format(CultureInfo.CurrentUICulture, SessionObjectPath, id, instanceId, name, computerName); } return message; @@ -551,7 +551,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { errRecords.Add( new ErrorRecord( - new CimException(String.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindCimsessionObject, propertyName, propertyValue)), + new CimException(string.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindCimsessionObject, propertyName, propertyValue)), string.Empty, ErrorCategory.ObjectNotFound, null)); @@ -870,7 +870,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimSessionState state; if (cimSessions.TryRemove(runspace.InstanceId, out state)) { - DebugHelper.WriteLog(String.Format(CultureInfo.CurrentUICulture, DebugHelper.runspaceStateChanged, runspace.InstanceId, e.RunspaceStateInfo.State)); + DebugHelper.WriteLog(string.Format(CultureInfo.CurrentUICulture, DebugHelper.runspaceStateChanged, runspace.InstanceId, e.RunspaceStateInfo.State)); state.Dispose(); } @@ -1001,7 +1001,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimTestCimSessionContext testCimSessionContext = context as CimTestCimSessionContext; UInt32 sessionId = this.sessionState.GenerateSessionId(); string originalSessionName = testCimSessionContext.CimSessionWrapper.Name; - string sessionName = (originalSessionName != null) ? originalSessionName : String.Format(CultureInfo.CurrentUICulture, @"{0}{1}", CimSessionState.CimSessionClassName, sessionId); + string sessionName = (originalSessionName != null) ? originalSessionName : string.Format(CultureInfo.CurrentUICulture, @"{0}{1}", CimSessionState.CimSessionClassName, sessionId); // detach CimSession from the proxy object CimSession createdCimSession = testCimSessionContext.Proxy.Detach(); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs index 73351cf74..8b62d7017 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs @@ -1223,7 +1223,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.operationParameters.Add(@"className", className); this.WriteOperationStartMessage(this.operationName, this.operationParameters); CimAsyncMultipleResults asyncResult = this.session.EnumerateInstancesAsync(namespaceName, className, this.options); - string errorSource = String.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); + string errorSource = string.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); ConsumeCimInstanceAsync(asyncResult, new CimResultContext(errorSource)); } @@ -1305,7 +1305,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.operationParameters.Add(@"className", className); this.WriteOperationStartMessage(this.operationName, this.operationParameters); CimAsyncMultipleResults asyncResult = this.session.EnumerateClassesAsync(namespaceName, className, this.options); - string errorSource = String.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); + string errorSource = string.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); ConsumeCimClassAsync(asyncResult, new CimResultContext(errorSource)); } @@ -1325,7 +1325,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.operationParameters.Add(@"className", className); this.WriteOperationStartMessage(this.operationName, this.operationParameters); CimAsyncResult asyncResult = this.session.GetClassAsync(namespaceName, className, this.options); - string errorSource = String.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); + string errorSource = string.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); ConsumeCimClassAsync(asyncResult, new CimResultContext(errorSource)); } @@ -1379,7 +1379,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.operationParameters.Add(@"methodName", methodName); this.WriteOperationStartMessage(this.operationName, this.operationParameters); CimAsyncMultipleResults asyncResult = this.session.InvokeMethodAsync(namespaceName, className, methodName, methodParameters, this.options); - string errorSource = String.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); + string errorSource = string.Format(CultureInfo.CurrentUICulture, "{0}:{1}", namespaceName, className); ConsumeCimInvokeMethodResultAsync(asyncResult, className, methodName, new CimResultContext(errorSource)); } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs index 17282ecde..50328005d 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs @@ -231,7 +231,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets if ((property.Flags & CimFlags.ReadOnly) == CimFlags.ReadOnly) { // can not modify ReadOnly property - exception = new CimException(String.Format(CultureInfo.CurrentUICulture, + exception = new CimException(string.Format(CultureInfo.CurrentUICulture, Strings.CouldNotModifyReadonlyProperty, key, cimInstance)); return false; } @@ -280,7 +280,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { if (e.NativeErrorCode == NativeErrorCode.Failed) { - string errorMessage = String.Format(CultureInfo.CurrentUICulture, + string errorMessage = string.Format(CultureInfo.CurrentUICulture, Strings.UnableToAddPropertyToInstance, newProperty.Name, cimInstance); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs index 80ea2dd0e..b58270115 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs @@ -234,8 +234,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimSetCimInstanceContext setContext = context as CimSetCimInstanceContext; if (setContext != null) { - if ((String.Compare(setContext.ParameterSetName, CimBaseCommand.QueryComputerSet, StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(setContext.ParameterSetName, CimBaseCommand.QuerySessionSet, StringComparison.OrdinalIgnoreCase) == 0)) + if ((string.Compare(setContext.ParameterSetName, CimBaseCommand.QueryComputerSet, StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(setContext.ParameterSetName, CimBaseCommand.QuerySessionSet, StringComparison.OrdinalIgnoreCase) == 0)) { this.setCimInstance.SetCimInstance(sendToPipeline as CimInstance, setContext, this); return; diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs index d50a90df2..9bedb09cf 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs @@ -633,7 +633,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets wsmanoptions.MaxEnvelopeSize = 0; } - if (!String.IsNullOrWhiteSpace(this.ProxyCertificateThumbprint)) + if (!string.IsNullOrWhiteSpace(this.ProxyCertificateThumbprint)) { CimCredential credentials = new CimCredential(CertificateAuthenticationMechanism.Default, this.ProxyCertificateThumbprint); wsmanoptions.AddProxyCredentials(credentials); diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs index 31bec0436..9b7b4e567 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs @@ -203,7 +203,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets case CimBaseCommand.ClassNameComputerSet: // validate the classname this.CheckArgument(); - tempQueryExpression = String.Format(CultureInfo.CurrentCulture, "Select * from {0}", this.ClassName); + tempQueryExpression = string.Format(CultureInfo.CurrentCulture, "Select * from {0}", this.ClassName); break; } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs index 60bb2fca4..b5b691927 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs @@ -255,7 +255,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// internal static void WriteLog(string message, int indent, params object[] args) { - String outMessage = String.Empty; + String outMessage = string.Empty; FormatLogMessage(ref outMessage, message, args); WriteLog(outMessage, indent); } @@ -276,7 +276,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// internal static void WriteLogEx(string message, int indent, params object[] args) { - String outMessage = String.Empty; + String outMessage = string.Empty; WriteLogInternal(string.Empty, 0, -1); FormatLogMessage(ref outMessage, message, args); WriteLogInternal(outMessage, indent, 3); @@ -313,7 +313,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets [Conditional("LOGENABLE")] private static void FormatLogMessage(ref String outMessage, string message, params object[] args) { - outMessage = String.Format(CultureInfo.CurrentCulture, message, args); + outMessage = string.Format(CultureInfo.CurrentCulture, message, args); } /// @@ -402,7 +402,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// public static void ValidateNoNullorWhiteSpaceArgument(string obj, string argumentName) { - if (String.IsNullOrWhiteSpace(obj)) + if (string.IsNullOrWhiteSpace(obj)) { throw new ArgumentException(argumentName); } @@ -433,7 +433,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } DebugHelper.WriteLogEx("An invalid name: {0}={1}", 0, parameterName, value); - throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Strings.InvalidParameterValue, value, parameterName)); + throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Strings.InvalidParameterValue, value, parameterName)); } /// @@ -451,7 +451,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets foreach (string propertyName in value) { // * is wild char supported in select properties - if ((propertyName != null) && (String.Compare(propertyName.Trim(), "*", StringComparison.OrdinalIgnoreCase) == 0)) + if ((propertyName != null) && (string.Compare(propertyName.Trim(), "*", StringComparison.OrdinalIgnoreCase) == 0)) { continue; } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs index 68c3f7653..eb3e4efe8 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs @@ -87,7 +87,7 @@ namespace Microsoft.PowerShell.Commands.Diagnostics.Common Debug.Assert(!string.IsNullOrEmpty(moduleName)); uint formatError = 0; - msg = String.Empty; + msg = string.Empty; IntPtr moduleHandle = IntPtr.Zero; moduleHandle = LoadLibraryEx(moduleName, IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs index 1916d6001..47d0cfe75 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs @@ -77,7 +77,7 @@ namespace Microsoft.PowerShell.Commands { WriteError(new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.InvalidDriveNameFormat, "C", "C:", "C:\\")), + string.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.InvalidDriveNameFormat, "C", "C:", "C:\\")), "InvalidDriveNameFormat", ErrorCategory.InvalidArgument, drive)); @@ -111,7 +111,7 @@ namespace Microsoft.PowerShell.Commands { foreach (DriveInfo drive in _availableDrives) { - if (String.Compare(drive.Name, drivePath, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(drive.Name, drivePath, StringComparison.OrdinalIgnoreCase) == 0) { actualDrive = drive; break; @@ -124,7 +124,7 @@ namespace Microsoft.PowerShell.Commands { WriteError(new ErrorRecord( new System.IO.DriveNotFoundException( - String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.DriveNotFound, drivePath, "Get-Volume")), + string.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.DriveNotFound, drivePath, "Get-Volume")), "DriveNotFound", ErrorCategory.InvalidArgument, drivePath)); @@ -139,7 +139,7 @@ namespace Microsoft.PowerShell.Commands WriteError(new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.InvalidDriveType, drivePath, "Get-Volume")), + string.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.InvalidDriveType, drivePath, "Get-Volume")), "InvalidDriveType", ErrorCategory.InvalidArgument, drivePath)); @@ -207,16 +207,16 @@ namespace Microsoft.PowerShell.Commands { // If driveName is null, then clear the recyclebin for all drives; otherwise, just for the specified driveName. - string activity = String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.ClearRecycleBinProgressActivity); + string activity = string.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.ClearRecycleBinProgressActivity); string statusDescription; if (drivePath == null) { - statusDescription = String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.ClearRecycleBinStatusDescriptionForAllDrives); + statusDescription = string.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.ClearRecycleBinStatusDescriptionForAllDrives); } else { - statusDescription = String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.ClearRecycleBinStatusDescriptionByDrive, drivePath); + statusDescription = string.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.ClearRecycleBinStatusDescriptionByDrive, drivePath); } ProgressRecord progress = new ProgressRecord(0, activity, statusDescription); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index df910a8f6..6503c66be 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -1900,7 +1900,7 @@ $result { if (!drive.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) { - driveApp = String.Concat(drive, "\\"); + driveApp = string.Concat(drive, "\\"); } else driveApp = drive; @@ -1993,7 +1993,7 @@ $result internal static void WriteNonTerminatingError(int errorcode, PSCmdlet cmdlet, string computername) { Win32Exception ex = new Win32Exception(errorcode); - string additionalmessage = String.Empty; + string additionalmessage = string.Empty; if (ex.NativeErrorCode.Equals(0x00000035)) { additionalmessage = StringUtil.Format(ComputerResources.NetworkPathNotFound, computername); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs index a2c3c3bf2..e3fb255b3 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs @@ -150,7 +150,7 @@ namespace Microsoft.PowerShell.Commands if (_currentContentItem != null && ((_currentContentItem.PathInfo == pathInfo) || ( - String.Compare( + string.Compare( pathInfo.Path, _currentContentItem.PathInfo.Path, StringComparison.OrdinalIgnoreCase) == 0) @@ -184,7 +184,7 @@ namespace Microsoft.PowerShell.Commands } else { - parentPath = SessionState.Path.ParseParent(pathInfo.Path, String.Empty, context); + parentPath = SessionState.Path.ParseParent(pathInfo.Path, string.Empty, context); } note = new PSNoteProperty("PSParentPath", parentPath); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs index fdffe8227..84b07b63c 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs @@ -215,7 +215,7 @@ namespace Microsoft.PowerShell.Commands internal override object GetDynamicParameters(CmdletProviderContext context) { object result = null; - string path = String.Empty; + string path = string.Empty; if (_paths != null && _paths.Length > 0) { @@ -289,7 +289,7 @@ namespace Microsoft.PowerShell.Commands if (_paths == null || _paths.Length == 0) { - _paths = new string[] { String.Empty }; + _paths = new string[] { string.Empty }; } foreach (string path in _paths) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetClipboardCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetClipboardCommand.cs index c6375a8de..07e5cfd3a 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetClipboardCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetClipboardCommand.cs @@ -96,7 +96,7 @@ namespace Microsoft.PowerShell.Commands if (Format != ClipboardFormat.Text && _isTextFormatTypeSet) { ThrowTerminatingError(new ErrorRecord(new InvalidOperationException( - String.Format(CultureInfo.InvariantCulture, ClipboardResources.InvalidTypeCombine)), + string.Format(CultureInfo.InvariantCulture, ClipboardResources.InvalidTypeCombine)), "FailedToGetClipboard", ErrorCategory.InvalidOperation, "Clipboard")); } @@ -104,7 +104,7 @@ namespace Microsoft.PowerShell.Commands if (Format != ClipboardFormat.Text && Format != ClipboardFormat.FileDropList && _isRawSet) { ThrowTerminatingError(new ErrorRecord(new InvalidOperationException( - String.Format(CultureInfo.InvariantCulture, ClipboardResources.InvalidRawCombine)), + string.Format(CultureInfo.InvariantCulture, ClipboardResources.InvalidRawCombine)), "FailedToGetClipboard", ErrorCategory.InvalidOperation, "Clipboard")); } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs index 2044c4d0c..8cbd12828 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs @@ -94,7 +94,7 @@ namespace Microsoft.PowerShell.Commands internal string GetQueryString() { StringBuilder returnValue = new StringBuilder("select "); - returnValue.Append(String.Join(", ", _property)); + returnValue.Append(string.Join(", ", _property)); returnValue.Append(" from "); returnValue.Append(Class); if (!string.IsNullOrEmpty(Filter)) @@ -216,7 +216,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( Thread.CurrentThread.CurrentCulture, "Class", this.Class)), "INVALID_QUERY_IDENTIFIER", @@ -380,19 +380,19 @@ namespace Microsoft.PowerShell.Commands if (e.ErrorCode.Equals(ManagementStatus.InvalidClass)) { string className = GetClassNameFromQuery(queryString); - string errorMsg = String.Format(CultureInfo.InvariantCulture, WmiResources.WmiQueryFailure, + string errorMsg = string.Format(CultureInfo.InvariantCulture, WmiResources.WmiQueryFailure, e.Message, className); errorRecord = new ErrorRecord(new ManagementException(errorMsg), "GetWMIManagementException", ErrorCategory.InvalidType, null); } else if (e.ErrorCode.Equals(ManagementStatus.InvalidQuery)) { - string errorMsg = String.Format(CultureInfo.InvariantCulture, WmiResources.WmiQueryFailure, + string errorMsg = string.Format(CultureInfo.InvariantCulture, WmiResources.WmiQueryFailure, e.Message, queryString); errorRecord = new ErrorRecord(new ManagementException(errorMsg), "GetWMIManagementException", ErrorCategory.InvalidArgument, null); } else if (e.ErrorCode.Equals(ManagementStatus.InvalidNamespace)) { - string errorMsg = String.Format(CultureInfo.InvariantCulture, WmiResources.WmiQueryFailure, + string errorMsg = string.Format(CultureInfo.InvariantCulture, WmiResources.WmiQueryFailure, e.Message, this.Namespace); errorRecord = new ErrorRecord(new ManagementException(errorMsg), "GetWMIManagementException", ErrorCategory.InvalidArgument, null); } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs index 3fcd3e57c..4ea452ff7 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs @@ -85,7 +85,7 @@ namespace Microsoft.PowerShell.Commands /// internal override object GetDynamicParameters(CmdletProviderContext context) { - string propertyName = String.Empty; + string propertyName = string.Empty; if (Name != null && Name.Length > 0) { propertyName = Name[0]; diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs index 7c75eb70d..55961b153 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs @@ -617,7 +617,7 @@ namespace Microsoft.PowerShell.Commands break; default: - Dbg.Diagnostics.Assert(false, String.Format(System.Globalization.CultureInfo.InvariantCulture, "One of the predefined parameter sets should have been specified, instead we got: {0}", ParameterSetName)); + Dbg.Diagnostics.Assert(false, string.Format(System.Globalization.CultureInfo.InvariantCulture, "One of the predefined parameter sets should have been specified, instead we got: {0}", ParameterSetName)); break; } } @@ -694,7 +694,7 @@ namespace Microsoft.PowerShell.Commands /// /// The filter used when doing a dir /// - private string _path = String.Empty; + private string _path = string.Empty; /// /// Determines if output should be passed through for @@ -872,7 +872,7 @@ namespace Microsoft.PowerShell.Commands /// /// The filter used when doing a dir /// - private string _path = String.Empty; + private string _path = string.Empty; /// /// Determines if output should be passed through for @@ -1222,7 +1222,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = NavigationResources.NewDriveConfirmResourceTemplate; string resource = - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, resourceTemplate, Name, @@ -1445,7 +1445,7 @@ namespace Microsoft.PowerShell.Commands if (base.SuppressWildcardExpansion) { - if (String.Equals(drive.Name, driveName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(drive.Name, driveName, StringComparison.OrdinalIgnoreCase)) addDrive = true; } else @@ -1594,7 +1594,7 @@ namespace Microsoft.PowerShell.Commands foreach (PSDriveInfo drive in GetMatchingDrives(driveName, PSProvider, Scope)) { string resource = - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, resourceTemplate, drive.Name, @@ -2109,7 +2109,7 @@ namespace Microsoft.PowerShell.Commands { if (Path == null || Path.Length == 0) { - Path = new string[] { String.Empty }; + Path = new string[] { string.Empty }; } foreach (string path in Path) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs index c55144602..ad40ae972 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs @@ -346,7 +346,7 @@ namespace Microsoft.PowerShell.Commands result = SessionState.Path.ParseParent( pathsToParse[index], - String.Empty, + string.Empty, CmdletProviderContext, true); } @@ -357,7 +357,7 @@ namespace Microsoft.PowerShell.Commands // provider. Since the paths for these types of // providers can't be split, asking for the parent // is asking for an empty string. - result = String.Empty; + result = string.Empty; } break; @@ -458,7 +458,7 @@ namespace Microsoft.PowerShell.Commands } else { - string driveName = String.Empty; + string driveName = string.Empty; if (SessionState.Path.IsPSAbsolute(path, out driveName)) { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs index 696ee678e..2e7152017 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs @@ -143,12 +143,12 @@ namespace Microsoft.PowerShell.Commands /// First Process object. /// Second Process object. /// - /// As String.Compare: returns less than zero if x less than y, + /// As string.Compare: returns less than zero if x less than y, /// greater than 0 if x greater than y, 0 if x == y. /// private static int ProcessComparison(Process x, Process y) { - int diff = String.Compare( + int diff = string.Compare( SafeGetProcessName(x), SafeGetProcessName(y), StringComparison.OrdinalIgnoreCase); @@ -2361,7 +2361,7 @@ namespace Microsoft.PowerShell.Commands SafeNativeMethods.PROCESS_INFORMATION lpProcessInformation = new SafeNativeMethods.PROCESS_INFORMATION(); int error = 0; GCHandle pinnedEnvironmentBlock = new GCHandle(); - string message = String.Empty; + string message = string.Empty; // building the cmdline with the file name given and it's arguments StringBuilder cmdLine = BuildCommandLine(startinfo.FileName, startinfo.Arguments); @@ -2982,7 +2982,7 @@ namespace Microsoft.PowerShell.Commands set { _processName = value; } } - private string _processName = String.Empty; + private string _processName = string.Empty; #endregion Properties } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs index e7d83737e..ba03f02a1 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs @@ -115,7 +115,7 @@ namespace Microsoft.PowerShell.Commands ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( Thread.CurrentThread.CurrentCulture, "Class", this.Class)), "INVALID_QUERY_IDENTIFIER", diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index ca0ddcc0a..e3fc8b564 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands string message = StringUtil.Format(errorMessage, serviceName, displayName, - (innerException == null) ? String.Empty : innerException.Message); + (innerException == null) ? string.Empty : innerException.Message); var exception = new ServiceCommandException(message, innerException); exception.ServiceName = serviceName; @@ -328,7 +328,7 @@ namespace Microsoft.PowerShell.Commands // sort by servicename private static int ServiceComparison(ServiceController x, ServiceController y) { - return String.Compare(x.ServiceName, y.ServiceName, StringComparison.OrdinalIgnoreCase); + return string.Compare(x.ServiceName, y.ServiceName, StringComparison.OrdinalIgnoreCase); } /// @@ -388,7 +388,7 @@ namespace Microsoft.PowerShell.Commands { WriteNonTerminatingError( pattern, - String.Empty, + string.Empty, pattern, null, "NoServiceFoundForGivenName", @@ -433,7 +433,7 @@ namespace Microsoft.PowerShell.Commands if (!found && !WildcardPattern.ContainsWildcardCharacters(pattern)) { WriteNonTerminatingError( - String.Empty, + string.Empty, pattern, pattern, null, @@ -1697,7 +1697,7 @@ namespace Microsoft.PowerShell.Commands try { hScManager = NativeMethods.OpenSCManagerW( - String.Empty, + string.Empty, null, NativeMethods.SC_MANAGER_CONNECT ); @@ -2062,7 +2062,7 @@ namespace Microsoft.PowerShell.Commands // confirm the operation first // this is always false if WhatIf is set - if (!ShouldProcessServiceOperation(DisplayName ?? String.Empty, Name)) + if (!ShouldProcessServiceOperation(DisplayName ?? string.Empty, Name)) { return; } @@ -2371,7 +2371,7 @@ namespace Microsoft.PowerShell.Commands try { hScManager = NativeMethods.OpenSCManagerW( - lpMachineName: String.Empty, + lpMachineName: string.Empty, lpDatabaseName: null, dwDesiredAccess: NativeMethods.SC_MANAGER_ALL_ACCESS ); @@ -2542,7 +2542,7 @@ namespace Microsoft.PowerShell.Commands set { _serviceName = value; } } - private string _serviceName = String.Empty; + private string _serviceName = string.Empty; #endregion Properties } #endregion ServiceCommandException diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs index 88c57c83b..f8c6fb346 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs @@ -98,7 +98,7 @@ namespace Microsoft.PowerShell.Commands if (Value == null && _isHtmlSet) { ThrowTerminatingError(new ErrorRecord(new InvalidOperationException( - String.Format(CultureInfo.InvariantCulture, ClipboardResources.InvalidHtmlCombine)), + string.Format(CultureInfo.InvariantCulture, ClipboardResources.InvalidHtmlCombine)), "FailedToSetClipboard", ErrorCategory.InvalidOperation, "Clipboard")); } @@ -147,7 +147,7 @@ namespace Microsoft.PowerShell.Commands if ((contentList == null || contentList.Count == 0) && !append) { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.ClipboardCleared); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.ClipboardCleared); if (ShouldProcess(setClipboardShouldProcessTarget, "Set-Clipboard")) { Clipboard.Clear(); @@ -161,7 +161,7 @@ namespace Microsoft.PowerShell.Commands { if (!Clipboard.ContainsText()) { - WriteVerbose(String.Format(CultureInfo.InvariantCulture, ClipboardResources.NoAppendableClipboardContent)); + WriteVerbose(string.Format(CultureInfo.InvariantCulture, ClipboardResources.NoAppendableClipboardContent)); append = false; } else @@ -189,11 +189,11 @@ namespace Microsoft.PowerShell.Commands if (append) { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.AppendClipboardContent, verboseString); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.AppendClipboardContent, verboseString); } else { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.SetClipboardContent, verboseString); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.SetClipboardContent, verboseString); } if (ShouldProcess(setClipboardShouldProcessTarget, "Set-Clipboard")) @@ -223,7 +223,7 @@ namespace Microsoft.PowerShell.Commands { if (!Clipboard.ContainsFileDropList()) { - WriteVerbose(String.Format(CultureInfo.InvariantCulture, ClipboardResources.NoAppendableClipboardContent)); + WriteVerbose(string.Format(CultureInfo.InvariantCulture, ClipboardResources.NoAppendableClipboardContent)); append = false; } else @@ -276,22 +276,22 @@ namespace Microsoft.PowerShell.Commands { if (append) { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.AppendSingleFileToClipboard, dropFiles.ElementAt(dropFiles.Count - 1)); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.AppendSingleFileToClipboard, dropFiles.ElementAt(dropFiles.Count - 1)); } else { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.SetSingleFileToClipboard, dropFiles.ElementAt(0)); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.SetSingleFileToClipboard, dropFiles.ElementAt(0)); } } else { if (append) { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.AppendMultipleFilesToClipboard, (dropFiles.Count - clipBoardContentLength)); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.AppendMultipleFilesToClipboard, (dropFiles.Count - clipBoardContentLength)); } else { - setClipboardShouldProcessTarget = String.Format(CultureInfo.InvariantCulture, ClipboardResources.SetMultipleFilesToClipboard, dropFiles.Count); + setClipboardShouldProcessTarget = string.Format(CultureInfo.InvariantCulture, ClipboardResources.SetMultipleFilesToClipboard, dropFiles.Count); } } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs index a52f9093f..4b22e6ef3 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs @@ -67,7 +67,7 @@ namespace Microsoft.PowerShell.Commands [Parameter(Position = 1, ParameterSetName = propertyValueLiteralPathSet, Mandatory = true, ValueFromPipelineByPropertyName = true)] [Alias("PSProperty")] - public string Name { get; set; } = String.Empty; + public string Name { get; set; } = string.Empty; /// /// The value of the property to set. diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs index 454214119..a8317793b 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs @@ -410,7 +410,7 @@ namespace Microsoft.PowerShell.Commands private void WriteTraceRouteProgress(TraceRouteReply traceRouteReply) { - String msg = String.Empty; + String msg = string.Empty; if (traceRouteReply.PingReplies[2].Status == IPStatus.TtlExpired || traceRouteReply.PingReplies[2].Status == IPStatus.Success) { @@ -753,7 +753,7 @@ namespace Microsoft.PowerShell.Commands private void WritePingProgress(PingReply reply) { - String msg = String.Empty; + String msg = string.Empty; if (reply.Status != IPStatus.Success) { msg = TestConnectionResources.PingTimeOut; diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs index 870f8e935..c69065d49 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs @@ -116,7 +116,7 @@ namespace Microsoft.PowerShell.Commands { GetWmiObjectCommand getObject = (GetWmiObjectCommand)_wmiObject; StringBuilder returnValue = new StringBuilder("select "); - returnValue.Append(String.Join(", ", getObject.Property)); + returnValue.Append(string.Join(", ", getObject.Property)); returnValue.Append(" from "); returnValue.Append(getObject.Class); if (!string.IsNullOrEmpty(getObject.Filter)) @@ -841,7 +841,7 @@ namespace Microsoft.PowerShell.Commands if (!getObject.ValidateClassFormat()) { ArgumentException e = new ArgumentException( - String.Format( + string.Format( Thread.CurrentThread.CurrentCulture, "Class", getObject.Class)); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs index 318a4f604..505c8e0ec 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs @@ -109,11 +109,11 @@ namespace Microsoft.PowerShell.Commands set { - _sourceCode = String.Empty; + _sourceCode = string.Empty; if (value != null) { - _sourceCode = String.Join("\n", value); + _sourceCode = string.Join("\n", value); } } } @@ -253,7 +253,7 @@ namespace Microsoft.PowerShell.Commands { activeExtension = currentExtension; } - else if (!String.Equals(activeExtension, currentExtension, StringComparison.OrdinalIgnoreCase)) + else if (!string.Equals(activeExtension, currentExtension, StringComparison.OrdinalIgnoreCase)) { // All files must have the same extension otherwise throw. ErrorRecord errorRecord = new ErrorRecord( @@ -355,7 +355,7 @@ namespace Microsoft.PowerShell.Commands // If it resolved to a non-standard provider, // generate an error. - if (!String.Equals("FileSystem", provider.Name, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals("FileSystem", provider.Name, StringComparison.OrdinalIgnoreCase)) { ThrowTerminatingError(errorRecord); return; @@ -459,17 +459,17 @@ namespace Microsoft.PowerShell.Commands private string GenerateTypeSource(string typeNamespace, string typeName, string sourceCodeText, Language language) { - string usingSource = String.Format( + string usingSource = string.Format( CultureInfo.InvariantCulture, GetUsingTemplate(language), GetUsingSet(language)); - string typeSource = String.Format( + string typeSource = string.Format( CultureInfo.InvariantCulture, GetMethodTemplate(language), typeName, sourceCodeText); if (!string.IsNullOrEmpty(typeNamespace)) { - return usingSource + String.Format( + return usingSource + string.Format( CultureInfo.InvariantCulture, GetNamespaceTemplate(language), typeNamespace, typeSource); } @@ -576,7 +576,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new Exception( - String.Format( + string.Format( CultureInfo.CurrentCulture, AddTypeStrings.OutputTypeRequiresOutputAssembly)), "OUTPUTTYPE_REQUIRES_ASSEMBLY", @@ -1060,7 +1060,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new Exception( - String.Format(AddTypeStrings.TypeAlreadyExists, symbolName)), + string.Format(AddTypeStrings.TypeAlreadyExists, symbolName)), "TYPE_ALREADY_EXISTS", ErrorCategory.InvalidOperation, symbolName); @@ -1207,9 +1207,9 @@ namespace Microsoft.PowerShell.Commands // and present in diagnostic report with DefaultSeverity equal to Hidden // so we skip them explicitly here too. if (diagnisticRecord.IsSuppressed || diagnisticRecord.DefaultSeverity == DiagnosticSeverity.Hidden || - String.Equals(diagnisticRecord.Id, "CS2008", StringComparison.InvariantCulture) || - String.Equals(diagnisticRecord.Id, "CS1562", StringComparison.InvariantCulture) || - String.Equals(diagnisticRecord.Id, "BC2008", StringComparison.InvariantCulture)) + string.Equals(diagnisticRecord.Id, "CS2008", StringComparison.InvariantCulture) || + string.Equals(diagnisticRecord.Id, "CS1562", StringComparison.InvariantCulture) || + string.Equals(diagnisticRecord.Id, "BC2008", StringComparison.InvariantCulture)) { continue; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs index aa713ebe3..56ef96489 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs @@ -1350,7 +1350,7 @@ namespace Microsoft.PowerShell.Commands { // throw a terminating error as there are duplicate headers in the input. string memberAlreadyPresentMsg = - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, ExtendedTypeSystem.MemberAlreadyPresent, currentHeader); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs index b3c343321..320614e7f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs @@ -32,14 +32,14 @@ namespace Microsoft.PowerShell.Commands /// [Parameter] public AccessRightTypeNames Type - { + { get { return _type; } set { _isTypeSet = true; _type = value; - } + } } private AccessRightTypeNames _type; @@ -138,7 +138,7 @@ namespace Microsoft.PowerShell.Commands List accessRightList = GetApplicableAccessRights(ace.AccessMask, typeName); if (accessRightList.Count > 0) { - string accessRights = String.Join(", ", accessRightList); + string accessRights = string.Join(", ", accessRightList); aceString.Append($" ({accessRights})"); } @@ -184,7 +184,7 @@ namespace Microsoft.PowerShell.Commands /// FileSystemRights. /// FileSystemRights, - + /// /// RegistryRights. /// @@ -210,7 +210,7 @@ namespace Microsoft.PowerShell.Commands /// /// EventWaitHandleRights. - /// + /// EventWaitHandleRights } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs index 1bbc70fb4..a03cbf8a3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs @@ -21,7 +21,7 @@ namespace Microsoft.PowerShell.Commands internal char Delimiter { get; } = ','; /// - /// Parse a CSV String. + /// Parse a CSV string. /// /// /// String to be parsed. diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs index 2e61a7a97..489b57c73 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs @@ -318,7 +318,7 @@ namespace Microsoft.PowerShell.Commands // file to vary based on locale. string result = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, formatString, alias.Name, diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs index 7dc4928f4..2fb408b13 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs @@ -35,7 +35,7 @@ namespace Microsoft.PowerShell.Commands } object objectResult = result.Result; - return objectResult == null ? String.Empty : ColumnInfo.LimitString(objectResult.ToString()); + return objectResult == null ? string.Empty : ColumnInfo.LimitString(objectResult.ToString()); } } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs index 895007715..7cab75828 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs @@ -84,13 +84,13 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - if (String.Equals(this.ParameterSetName, "ByInputObject", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(this.ParameterSetName, "ByInputObject", StringComparison.OrdinalIgnoreCase)) { ProcessObjectContent(InputObject); } else { - List pathsToProcess = String.Equals(this.ParameterSetName, "LiteralPath", StringComparison.OrdinalIgnoreCase) ? + List pathsToProcess = string.Equals(this.ParameterSetName, "LiteralPath", StringComparison.OrdinalIgnoreCase) ? ResolvePaths(LiteralPath, true) : ResolvePaths(Path, false); ProcessPath(pathsToProcess); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs index e524cf804..c006efccc 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs @@ -298,20 +298,20 @@ namespace Microsoft.PowerShell.Commands // These are the ISO 8601 "basic" formats, dropping dashes and colons // so that they can be used in file names - if (String.Equals("FileDate", Format, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("FileDate", Format, StringComparison.OrdinalIgnoreCase)) { Format = "yyyyMMdd"; } - else if (String.Equals("FileDateUniversal", Format, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals("FileDateUniversal", Format, StringComparison.OrdinalIgnoreCase)) { dateToUse = dateToUse.ToUniversalTime(); Format = "yyyyMMddZ"; } - else if (String.Equals("FileDateTime", Format, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals("FileDateTime", Format, StringComparison.OrdinalIgnoreCase)) { Format = "yyyyMMddTHHmmssffff"; } - else if (String.Equals("FileDateTimeUniversal", Format, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals("FileDateTimeUniversal", Format, StringComparison.OrdinalIgnoreCase)) { dateToUse = dateToUse.ToUniversalTime(); Format = "yyyyMMddTHHmmssffffZ"; @@ -392,7 +392,7 @@ namespace Microsoft.PowerShell.Commands case 'F': sb.Append("{0:yyyy}-{0:MM}-{0:dd}"); break; - + case 'G': sb.Append("{0:yyyy}"); break; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs index d66151875..32668b343 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs @@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands } ErrorRecord errorRecord = new ErrorRecord( - new ArgumentException(String.Format(System.Globalization.CultureInfo.CurrentCulture, error, identifier)), + new ArgumentException(string.Format(System.Globalization.CultureInfo.CurrentCulture, error, identifier)), "INVALID_SOURCE_IDENTIFIER", ErrorCategory.InvalidArgument, null); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs index 3f5835d0d..b1c1eb09b 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands } ErrorRecord errorRecord = new ErrorRecord( - new ArgumentException(String.Format(System.Globalization.CultureInfo.CurrentCulture, error, identifier)), + new ArgumentException(string.Format(System.Globalization.CultureInfo.CurrentCulture, error, identifier)), "INVALID_SOURCE_IDENTIFIER", ErrorCategory.InvalidArgument, null); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs index 87df561af..221b4c946 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs @@ -254,14 +254,14 @@ namespace Microsoft.PowerShell.Commands { public int Compare(MemberDefinition first, MemberDefinition second) { - int result = String.Compare(first.MemberType.ToString(), second.MemberType.ToString(), + int result = string.Compare(first.MemberType.ToString(), second.MemberType.ToString(), StringComparison.OrdinalIgnoreCase); if (result != 0) { return result; } - return String.Compare(first.Name, second.Name, StringComparison.OrdinalIgnoreCase); + return string.Compare(first.Name, second.Name, StringComparison.OrdinalIgnoreCase); } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs index a1ebb9cac..f2c8aa7d3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs @@ -91,7 +91,7 @@ namespace Microsoft.PowerShell.Commands } ErrorRecord errorRecord = new ErrorRecord( - new ArgumentException(String.Format( + new ArgumentException(string.Format( CultureInfo.InvariantCulture, GetRandomCommandStrings.MinGreaterThanOrEqualMax, min, max)), "MinGreaterThanOrEqualMax", ErrorCategory.InvalidArgument, diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs index de15cb6be..f006e1d46 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs @@ -77,7 +77,7 @@ namespace Microsoft.PowerShell.Commands _lastObjectAsString = _lastObject.ToString(); } - if (0 == String.Compare( + if (0 == string.Compare( inputString, _lastObjectAsString, StringComparison.CurrentCulture)) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs index 7927a85e5..97346af3b 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs @@ -2523,7 +2523,7 @@ function Get-PSImplicitRemotingSession NewVMRunspaceTemplate, /* 0 */ this.GenerateConnectionStringForNewRunspace(), /* 1 */ this.GenerateCredentialParameter(), - /* 2 */ string.IsNullOrEmpty(vmConfigurationName) ? String.Empty : String.Concat("-ConfigurationName ", vmConfigurationName)); + /* 2 */ string.IsNullOrEmpty(vmConfigurationName) ? string.Empty : string.Concat("-ConfigurationName ", vmConfigurationName)); } else { @@ -2536,7 +2536,7 @@ function Get-PSImplicitRemotingSession NewContainerRunspaceTemplate, /* 0 */ this.GenerateConnectionStringForNewRunspace(), /* 1 */ containerConnectionInfo.ContainerProc.RunAsAdmin ? "-RunAsAdministrator" : string.Empty, - /* 2 */ string.IsNullOrEmpty(containerConfigurationName) ? String.Empty : String.Concat("-ConfigurationName ", containerConfigurationName)); + /* 2 */ string.IsNullOrEmpty(containerConfigurationName) ? string.Empty : string.Concat("-ConfigurationName ", containerConfigurationName)); } else { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs index 6ccd80df0..ba73e1021 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs @@ -452,7 +452,7 @@ namespace Microsoft.PowerShell.Commands { get { - return String.Compare(ParameterSetName, GenericParameterSet, StringComparison.Ordinal) == 0; + return string.Compare(ParameterSetName, GenericParameterSet, StringComparison.Ordinal) == 0; } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveEventCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveEventCommand.cs index 03099f196..83aa745ed 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveEventCommand.cs @@ -94,7 +94,7 @@ namespace Microsoft.PowerShell.Commands foundMatch = true; if (ShouldProcess( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingStrings.EventResource, currentEvent.SourceIdentifier), @@ -113,7 +113,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingStrings.SourceIdentifierNotFound, _sourceIdentifier)), "INVALID_SOURCE_IDENTIFIER", @@ -126,7 +126,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingStrings.EventIdentifierNotFound, _eventIdentifier)), "INVALID_EVENT_IDENTIFIER", diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs index 3e26aaac7..c91bd709c 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs @@ -181,7 +181,7 @@ namespace Microsoft.PowerShell.Commands if (_showCommandProxy.ScreenHeight < this.Height) { ErrorRecord error = new ErrorRecord( - new NotSupportedException(String.Format(CultureInfo.CurrentUICulture, FormatAndOut_out_gridview.PropertyValidate, "Height", _showCommandProxy.ScreenHeight)), + new NotSupportedException(string.Format(CultureInfo.CurrentUICulture, FormatAndOut_out_gridview.PropertyValidate, "Height", _showCommandProxy.ScreenHeight)), "PARAMETER_DATA_ERROR", ErrorCategory.InvalidData, null); @@ -191,7 +191,7 @@ namespace Microsoft.PowerShell.Commands if (_showCommandProxy.ScreenWidth < this.Width) { ErrorRecord error = new ErrorRecord( - new NotSupportedException(String.Format(CultureInfo.CurrentUICulture, FormatAndOut_out_gridview.PropertyValidate, "Width", _showCommandProxy.ScreenWidth)), + new NotSupportedException(string.Format(CultureInfo.CurrentUICulture, FormatAndOut_out_gridview.PropertyValidate, "Width", _showCommandProxy.ScreenWidth)), "PARAMETER_DATA_ERROR", ErrorCategory.InvalidData, null); @@ -293,7 +293,7 @@ namespace Microsoft.PowerShell.Commands private void IssueErrorForNoCommand() { InvalidOperationException errorException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.CurrentUICulture, FormatAndOut_out_gridview.CommandNotFound, Name)); @@ -306,7 +306,7 @@ namespace Microsoft.PowerShell.Commands private void IssueErrorForMoreThanOneCommand() { InvalidOperationException errorException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.CurrentUICulture, FormatAndOut_out_gridview.MoreThanOneCommand, Name, diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandParameterType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandParameterType.cs index cd74cbe4c..734595847 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandParameterType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandParameterType.cs @@ -108,7 +108,7 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension { get { - return String.Equals(this.FullName, "System.String", StringComparison.OrdinalIgnoreCase); + return string.Equals(this.FullName, "System.String", StringComparison.OrdinalIgnoreCase); } } @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension { get { - return String.Equals(this.FullName, "System.Management.Automation.ScriptBlock", StringComparison.OrdinalIgnoreCase); + return string.Equals(this.FullName, "System.Management.Automation.ScriptBlock", StringComparison.OrdinalIgnoreCase); } } @@ -130,7 +130,7 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension { get { - return String.Equals(this.FullName, "System.Management.Automation.ScriptBlock", StringComparison.OrdinalIgnoreCase); + return string.Equals(this.FullName, "System.Management.Automation.ScriptBlock", StringComparison.OrdinalIgnoreCase); } } @@ -141,7 +141,7 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension { get { - return String.Equals(this.FullName, "System.Management.Automation.SwitchParameter", StringComparison.OrdinalIgnoreCase); + return string.Equals(this.FullName, "System.Management.Automation.SwitchParameter", StringComparison.OrdinalIgnoreCase); } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs index 401ce2ab8..f159e1f60 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs @@ -70,7 +70,7 @@ namespace Microsoft.PowerShell.Commands List pathsToProcess = new List(); ProviderInfo provider = null; - if (String.Equals(this.ParameterSetName, "ByLiteralPath", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(this.ParameterSetName, "ByLiteralPath", StringComparison.OrdinalIgnoreCase)) { foreach (string path in _paths) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnregisterEventCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnregisterEventCommand.cs index fb8f17eb5..23adc57cd 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnregisterEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnregisterEventCommand.cs @@ -80,7 +80,7 @@ namespace Microsoft.PowerShell.Commands _foundMatch = true; if (ShouldProcess( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingStrings.EventSubscription, subscriber.SourceIdentifier), @@ -99,7 +99,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingStrings.EventSubscriptionNotFound, _sourceIdentifier)), "INVALID_SOURCE_IDENTIFIER", @@ -113,7 +113,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingStrings.EventSubscriptionNotFound, SubscriptionId)), "INVALID_SUBSCRIPTION_IDENTIFIER", diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs index dea173920..990bdbe22 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs @@ -403,7 +403,7 @@ namespace Microsoft.PowerShell.Commands /// private void ProcessDynamicType() { - if (String.IsNullOrWhiteSpace(_typeName)) + if (string.IsNullOrWhiteSpace(_typeName)) { ThrowTerminatingError(NewError("TargetTypeNameEmpty", UpdateDataStrings.TargetTypeNameEmpty, _typeName)); } @@ -1196,7 +1196,7 @@ namespace Microsoft.PowerShell.Commands } else { - if (String.IsNullOrWhiteSpace(_typeName)) + if (string.IsNullOrWhiteSpace(_typeName)) { ThrowTerminatingError(NewError("TargetTypeNameEmpty", UpdateDataStrings.TargetTypeNameEmpty, _typeName)); } @@ -1292,7 +1292,7 @@ namespace Microsoft.PowerShell.Commands var exception = new InvalidOperationException(UpdateDataStrings.TargetTypeNameEmpty); foreach (string typeName in TypeName) { - if (String.IsNullOrWhiteSpace(typeName)) + if (string.IsNullOrWhiteSpace(typeName)) { WriteError( new ErrorRecord( diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs index beb5f1418..c2ad7dacf 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs @@ -852,7 +852,7 @@ namespace Microsoft.PowerShell.Commands ScopedItemOptions newOptions = ScopedItemOptions.None; if (!string.IsNullOrEmpty(Scope) && - String.Equals("private", Scope, StringComparison.OrdinalIgnoreCase)) + string.Equals("private", Scope, StringComparison.OrdinalIgnoreCase)) { newOptions = ScopedItemOptions.Private; } @@ -876,7 +876,7 @@ namespace Microsoft.PowerShell.Commands if (Description == null) { - Description = String.Empty; + Description = string.Empty; } varToSet.Description = Description; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs index a17212cd2..8bc9b34cf 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs @@ -91,8 +91,8 @@ namespace Microsoft.PowerShell.Commands int readCount = 0; while ((readCount < 10) && reader.Read()) { - if (String.Equals("rss", reader.Name, StringComparison.OrdinalIgnoreCase) || - String.Equals("feed", reader.Name, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("rss", reader.Name, StringComparison.OrdinalIgnoreCase) || + string.Equals("feed", reader.Name, StringComparison.OrdinalIgnoreCase)) { isRssOrFeed = true; break; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs index baef6ab1c..427adcf1f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs @@ -765,7 +765,7 @@ namespace Microsoft.PowerShell.Commands // URLEncode the key and value string encodedKey = WebUtility.UrlEncode(key); - string encodedValue = String.Empty; + string encodedValue = string.Empty; if (value != null) { encodedValue = WebUtility.UrlEncode(value.ToString()); @@ -804,14 +804,14 @@ namespace Microsoft.PowerShell.Commands private string GetBasicAuthorizationHeader() { - string unencoded = String.Format("{0}:{1}", Credential.UserName, Credential.GetNetworkCredential().Password); + string unencoded = string.Format("{0}:{1}", Credential.UserName, Credential.GetNetworkCredential().Password); byte[] bytes = Encoding.UTF8.GetBytes(unencoded); - return String.Format("Basic {0}", Convert.ToBase64String(bytes)); + return string.Format("Basic {0}", Convert.ToBase64String(bytes)); } private string GetBearerAuthorizationHeader() { - return String.Format("Bearer {0}", new NetworkCredential(String.Empty, Token).Password); + return string.Format("Bearer {0}", new NetworkCredential(string.Empty, Token).Password); } private void ProcessAuthentication() @@ -826,7 +826,7 @@ namespace Microsoft.PowerShell.Commands } else { - Diagnostics.Assert(false, String.Format("Unrecognized Authentication value: {0}", Authentication)); + Diagnostics.Assert(false, string.Format("Unrecognized Authentication value: {0}", Authentication)); } } @@ -1393,7 +1393,7 @@ namespace Microsoft.PowerShell.Commands requestContentLength = requestWithoutRange.Content.Headers.ContentLength.Value; } - string reqVerboseMsg = String.Format( + string reqVerboseMsg = string.Format( CultureInfo.CurrentCulture, WebCmdletStrings.WebMethodInvocationVerboseMsg, requestWithoutRange.Method, @@ -1488,7 +1488,7 @@ namespace Microsoft.PowerShell.Commands if (request.Content != null) requestContentLength = request.Content.Headers.ContentLength.Value; - string reqVerboseMsg = String.Format(CultureInfo.CurrentCulture, + string reqVerboseMsg = string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.WebMethodInvocationVerboseMsg, request.Method, request.RequestUri, @@ -1514,14 +1514,14 @@ namespace Microsoft.PowerShell.Commands response.Content.Headers.ContentRange.Length == _resumeFileSize) { _isSuccess = true; - WriteVerbose(String.Format(CultureInfo.CurrentCulture, WebCmdletStrings.OutFileWritingSkipped, OutFile)); + WriteVerbose(string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.OutFileWritingSkipped, OutFile)); // Disable writing to the OutFile. OutFile = null; } if (!_isSuccess) { - string message = String.Format(CultureInfo.CurrentCulture, WebCmdletStrings.ResponseStatusCodeFailure, + string message = string.Format(CultureInfo.CurrentCulture, WebCmdletStrings.ResponseStatusCodeFailure, (int)response.StatusCode, response.ReasonPhrase); HttpResponseException httpEx = new HttpResponseException(message, response); ErrorRecord er = new ErrorRecord(httpEx, "WebCmdletWebResponseException", ErrorCategory.InvalidOperation, request); @@ -1828,7 +1828,7 @@ namespace Microsoft.PowerShell.Commands { string url = match.Groups["url"].Value; string rel = match.Groups["rel"].Value; - if (url != String.Empty && rel != String.Empty && !_relationLink.ContainsKey(rel)) + if (url != string.Empty && rel != string.Empty && !_relationLink.ContainsKey(rel)) { Uri absoluteUri = new Uri(requestUri, url); _relationLink.Add(rel, absoluteUri.AbsoluteUri.ToString()); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertFromJsonCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertFromJsonCommand.cs index 5fa479731..f08d182bc 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertFromJsonCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertFromJsonCommand.cs @@ -95,7 +95,7 @@ namespace Microsoft.PowerShell.Commands /// /// ConvertFromJsonHelper is a helper method to convert to Json input to .Net Type. /// - /// Input String. + /// Input string. /// True if successfully converted, else returns false. private bool ConvertFromJsonHelper(string input) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/PSUserAgent.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/PSUserAgent.cs index 03aa40a96..e74fabb14 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/PSUserAgent.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/PSUserAgent.cs @@ -152,7 +152,7 @@ namespace Microsoft.PowerShell.Commands { // unknown/unsupported platform Diagnostics.Assert(false, "Unable to determine Operating System Platform"); - return String.Empty; + return string.Empty; } } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteAliasCommandBase.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteAliasCommandBase.cs index b1a38d393..d2a8d8caa 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteAliasCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteAliasCommandBase.cs @@ -30,7 +30,7 @@ namespace Microsoft.PowerShell.Commands /// The description for the alias. /// [Parameter] - public string Description { get; set; } = String.Empty; + public string Description { get; set; } = string.Empty; /// /// The Option parameter allows the alias to be set to diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs index ba2a64586..eb6e757d6 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs @@ -1159,7 +1159,7 @@ namespace Microsoft.PowerShell.Commands /// internal string GetNodeText() { - string nodeText = String.Empty; + string nodeText = string.Empty; if (Node != null) { if (Node.Value != null) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/tee-object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/tee-object.cs index 541969ba4..de68585d5 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/tee-object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/tee-object.cs @@ -89,13 +89,13 @@ namespace Microsoft.PowerShell.Commands protected override void BeginProcessing() { _commandWrapper = new CommandWrapper(); - if (String.Equals(ParameterSetName, "File", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(ParameterSetName, "File", StringComparison.OrdinalIgnoreCase)) { _commandWrapper.Initialize(Context, "out-file", typeof(OutFileCommand)); _commandWrapper.AddNamedParameter("filepath", _fileName); _commandWrapper.AddNamedParameter("append", _append); } - else if (String.Equals(ParameterSetName, "LiteralFile", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(ParameterSetName, "LiteralFile", StringComparison.OrdinalIgnoreCase)) { _commandWrapper.Initialize(Context, "out-file", typeof(OutFileCommand)); _commandWrapper.AddNamedParameter("LiteralPath", _fileName); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs index a5ff2b59b..af77b50c3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs @@ -148,7 +148,7 @@ namespace Microsoft.PowerShell.Commands PSTraceSource newTraceSource = PSTraceSource.GetNewTraceSource( notMatchedName, - String.Empty, + string.Empty, true); preconfiguredSources.Add(newTraceSource); diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs index b6f98583b..02a8a2f82 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs @@ -161,7 +161,7 @@ namespace Microsoft.PowerShell public override string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", Left, Top, Right, Bottom); + return string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", Left, Top, Right, Bottom); } } @@ -192,7 +192,7 @@ namespace Microsoft.PowerShell public override string ToString() { - return String.Format(CultureInfo.InvariantCulture, "Size: {0}, Visible: {1}", Size, Visible); + return string.Format(CultureInfo.InvariantCulture, "Size: {0}, Visible: {1}", Size, Visible); } } @@ -737,7 +737,7 @@ namespace Microsoft.PowerShell { Dbg.Assert(!consoleHandle.IsInvalid, "ConsoleHandle is not valid"); Dbg.Assert(!consoleHandle.IsClosed, "ConsoleHandle is closed"); - Dbg.Assert(initialContent != null, "if no initial content is desired, pass String.Empty"); + Dbg.Assert(initialContent != null, "if no initial content is desired, pass string.Empty"); keyState = 0; CONSOLE_READCONSOLE_CONTROL control = new CONSOLE_READCONSOLE_CONTROL(); @@ -2486,7 +2486,7 @@ namespace Microsoft.PowerShell // the difference, we'll just return the empty string every time. if (result == 0) { - return String.Empty; + return string.Empty; } return consoleTitle.ToString(); diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 023df86e2..40edf1c26 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -2103,7 +2103,7 @@ namespace Microsoft.PowerShell foreach (Breakpoint breakpoint in e.Breakpoints) { - WriteDebuggerMessage(String.Format(CultureInfo.CurrentCulture, format, breakpoint)); + WriteDebuggerMessage(string.Format(CultureInfo.CurrentCulture, format, breakpoint)); } WriteDebuggerMessage(string.Empty); diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index 8d79f5639..a536b3fdc 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -1503,7 +1503,7 @@ namespace Microsoft.PowerShell /// /// Cached Window Title, for systems that needs it /// - private string _title = String.Empty; + private string _title = string.Empty; /// /// Gets or sets the title of the displayed window. The example @@ -1569,7 +1569,7 @@ namespace Microsoft.PowerShell public override string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", Left, Top, Right, Bottom); + return string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", Left, Top, Right, Bottom); } } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs index e6061e059..f551f6bb4 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs @@ -67,7 +67,7 @@ namespace Microsoft.PowerShell } } */ - private string _transcriptFileName = String.Empty; + private string _transcriptFileName = string.Empty; internal string diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs index 2b73f84d2..1c1595a61 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs @@ -320,7 +320,7 @@ namespace Microsoft.PowerShell } string choice = - String.Format( + string.Format( CultureInfo.InvariantCulture, choiceTemplate, hotkeysAndPlainLabels[0, i], @@ -438,7 +438,7 @@ namespace Microsoft.PowerShell WriteLineToConsole( WrapToCurrentWindowWidth( - String.Format(CultureInfo.InvariantCulture, "{0} - {1}", s, choices[i].HelpMessage))); + string.Format(CultureInfo.InvariantCulture, "{0} - {1}", s, choices[i].HelpMessage))); } } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs index 9ddedee13..ff7ba24fa 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs @@ -500,7 +500,7 @@ namespace Microsoft.PowerShell // we got back one or more objects. Pick off the first result. if (streamResults[0] == null) - return String.Empty; + return string.Empty; // And convert the base object into a string. We can't use the proxied // ToString() on the PSObject because there is no default runspace diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Serialization.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Serialization.cs index ff8284b25..b76b6ca12 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Serialization.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Serialization.cs @@ -162,7 +162,7 @@ namespace Microsoft.PowerShell textReader = input; _firstLine = textReader.ReadLine(); - if (String.Compare(_firstLine, Serialization.XmlCliTag, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(_firstLine, Serialization.XmlCliTag, StringComparison.OrdinalIgnoreCase) == 0) { // format should be XML diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs index 58794e92f..76896dea1 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs @@ -220,7 +220,7 @@ namespace Microsoft.PowerShell.Commands } else { - string errorMessage = String.Format( + string errorMessage = string.Format( System.Globalization.CultureInfo.CurrentCulture, TranscriptStrings.TranscriptFileReadOnly, effectiveFilePath); @@ -260,7 +260,7 @@ namespace Microsoft.PowerShell.Commands { } - string errorMessage = String.Format( + string errorMessage = string.Format( System.Globalization.CultureInfo.CurrentCulture, TranscriptStrings.CannotStartTranscription, e.Message); diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProviderTraceListener.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProviderTraceListener.cs index c2a9c026e..53878e835 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProviderTraceListener.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProviderTraceListener.cs @@ -222,7 +222,7 @@ namespace System.Diagnostics.Eventing return; } - _provider.WriteMessageEvent(String.Empty, + _provider.WriteMessageEvent(string.Empty, (byte)eventType, (long)eventType & s_keyWordMask); } @@ -267,7 +267,7 @@ namespace System.Diagnostics.Eventing } else { - _provider.WriteMessageEvent(String.Format(CultureInfo.InvariantCulture, format, args), + _provider.WriteMessageEvent(string.Format(CultureInfo.InvariantCulture, format, args), (byte)eventType, (long)eventType & s_keyWordMask); } diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs index 3075b7e45..8d495decc 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs @@ -207,11 +207,11 @@ namespace System.Diagnostics.Eventing.Reader if (channelRefDisplayName == null && isImported) { - if (String.Compare(channelName, "Application", StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(channelName, "Application", StringComparison.OrdinalIgnoreCase) == 0) channelRefMessageId = 256; - else if (String.Compare(channelName, "System", StringComparison.OrdinalIgnoreCase) == 0) + else if (string.Compare(channelName, "System", StringComparison.OrdinalIgnoreCase) == 0) channelRefMessageId = 258; - else if (String.Compare(channelName, "Security", StringComparison.OrdinalIgnoreCase) == 0) + else if (string.Compare(channelName, "Security", StringComparison.OrdinalIgnoreCase) == 0) channelRefMessageId = 257; else channelRefMessageId = -1; diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Native.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Native.cs index a14710aac..c220dc009 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Native.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Native.cs @@ -126,7 +126,7 @@ namespace System.Management.Automation.SecurityAccountsManager.Native public UNICODE_STRING(string s) { - buffer = string.IsNullOrEmpty(s) ? String.Empty : s; + buffer = string.IsNullOrEmpty(s) ? string.Empty : s; Length = (UInt16)(2 * buffer.Length); MaximumLength = Length; } @@ -137,7 +137,7 @@ namespace System.Management.Automation.SecurityAccountsManager.Native // often have buffers that point to junk if Length = 0, or that // point to non-null-terminated strings, resulting in marshaled // String objects that have more characters than they should. - return Length == 0 ? String.Empty + return Length == 0 ? string.Empty : buffer.Substring(0, Length / 2); } } diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs index 38c57f63b..0d8dc7e96 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs @@ -369,7 +369,7 @@ namespace System.Management.Automation.SecurityAccountsManager private IntPtr localDomainHandle = IntPtr.Zero; private IntPtr builtinDomainHandle = IntPtr.Zero; private Context context = null; - private string machineName = String.Empty; + private string machineName = string.Empty; #endregion Instance Data #region Construction diff --git a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs index e77151afe..371cdd58c 100644 --- a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs +++ b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs @@ -2310,12 +2310,12 @@ namespace Microsoft.PowerShell.ScheduledJob { internal static string Format(string formatSpec, object o) { - return String.Format(System.Threading.Thread.CurrentThread.CurrentCulture, formatSpec, o); + return string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, formatSpec, o); } internal static string Format(string formatSpec, params object[] o) { - return String.Format(System.Threading.Thread.CurrentThread.CurrentCulture, formatSpec, o); + return string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, formatSpec, o); } } diff --git a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs index 63c10698c..746873ba7 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs @@ -102,7 +102,7 @@ namespace Microsoft.PowerShell.Commands if (_unicodeName != null && dnsName._unicodeName != null) { - if (String.Equals( + if (string.Equals( _unicodeName, dnsName._unicodeName, StringComparison.OrdinalIgnoreCase)) @@ -151,7 +151,7 @@ namespace Microsoft.PowerShell.Commands // to differ only by upper/lower case. If they do, that's really // a code bug, and the effect is to just display both strings. - return String.Equals(_punycodeName, _unicodeName) ? + return string.Equals(_punycodeName, _unicodeName) ? _punycodeName : _unicodeName + " (" + _punycodeName + ")"; } @@ -296,7 +296,7 @@ namespace Microsoft.PowerShell.Commands _storeHandle.Handle = hCertStore; //we only do CertControlStore for stores other than UserDS - if (!String.Equals( + if (!string.Equals( _storeName, "UserDS", StringComparison.OrdinalIgnoreCase)) @@ -385,7 +385,7 @@ namespace Microsoft.PowerShell.Commands } X509Certificate2 cert = new X509Certificate2(certContext); - if (String.Equals( + if (string.Equals( cert.Thumbprint, Name, StringComparison.OrdinalIgnoreCase)) @@ -650,14 +650,14 @@ namespace Microsoft.PowerShell.Commands object outObj = GetItemAtPath(path, false, out isContainer); string[] pathElements = GetPathElements(path); - bool fUserContext = String.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase); + bool fUserContext = string.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase); // isContainer = true means not a valid certificate // if source store is user root store and UI is not allowed // we raise invalid operation if (DetectUIHelper.GetOwnerWindow(Host) == IntPtr.Zero && fUserContext && - String.Equals(pathElements[1], "ROOT", StringComparison.OrdinalIgnoreCase)) + string.Equals(pathElements[1], "ROOT", StringComparison.OrdinalIgnoreCase)) { string message = CertificateProviderStrings.UINotAllowed; string errorId = "UINotAllowed"; @@ -775,7 +775,7 @@ namespace Microsoft.PowerShell.Commands { //if the destination leads to the same thumbprint if (destElements.Length == 3 && - (String.Equals(pathElements[2], destElements[2], StringComparison.OrdinalIgnoreCase))) + (string.Equals(pathElements[2], destElements[2], StringComparison.OrdinalIgnoreCase))) { //in this case we think of destination path as valid //and strip the thumbprint part @@ -793,14 +793,14 @@ namespace Microsoft.PowerShell.Commands //we do not allow cross context move //we do not allow the destination store is the same as source - if (!String.Equals(pathElements[0], destElements[0], StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(pathElements[0], destElements[0], StringComparison.OrdinalIgnoreCase)) { string message = CertificateProviderStrings.CannotMoveCrossContext; string errorId = "CannotMoveCrossContext"; ThrowInvalidOperation(errorId, message); } - if (String.Equals(pathElements[1], destElements[1], StringComparison.OrdinalIgnoreCase)) + if (string.Equals(pathElements[1], destElements[1], StringComparison.OrdinalIgnoreCase)) { string message = CertificateProviderStrings.CannotMoveToSameStore; string errorId = "CannotMoveToSameStore"; @@ -811,10 +811,10 @@ namespace Microsoft.PowerShell.Commands // we raise invalid operation if (DetectUIHelper.GetOwnerWindow(Host) == IntPtr.Zero) { - if ((String.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase) && - String.Equals(pathElements[1], "ROOT", StringComparison.OrdinalIgnoreCase)) || - (String.Equals(destElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase) && - String.Equals(destElements[1], "ROOT", StringComparison.OrdinalIgnoreCase))) + if ((string.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase) && + string.Equals(pathElements[1], "ROOT", StringComparison.OrdinalIgnoreCase)) || + (string.Equals(destElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase) && + string.Equals(destElements[1], "ROOT", StringComparison.OrdinalIgnoreCase))) { string message = CertificateProviderStrings.UINotAllowed; string errorId = "UINotAllowed"; @@ -836,7 +836,7 @@ namespace Microsoft.PowerShell.Commands certstore.Open(true); string action = CertificateProviderStrings.Action_Move; - string resource = String.Format( + string resource = string.Format( CultureInfo.CurrentCulture, CertificateProviderStrings.MoveItemTemplate, path, @@ -905,7 +905,7 @@ namespace Microsoft.PowerShell.Commands ThrowInvalidOperation(errorId, message); } - bool fUserContext = String.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase); + bool fUserContext = string.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase); //not support user context if (fUserContext) @@ -1422,7 +1422,7 @@ namespace Microsoft.PowerShell.Commands break; } - message = String.Format( + message = string.Format( System.Globalization.CultureInfo.CurrentCulture, message, path); ErrorDetails ed = new ErrorDetails(message); @@ -1517,7 +1517,7 @@ namespace Microsoft.PowerShell.Commands string[] elts = GetPathElements(path); - path = String.Join("\\", elts); + path = string.Join("\\", elts); } return path; @@ -1532,7 +1532,7 @@ namespace Microsoft.PowerShell.Commands foreach (string e in allElts) { - if ((e == ".") || (e == String.Empty)) + if ((e == ".") || (e == string.Empty)) { continue; } @@ -1735,7 +1735,7 @@ namespace Microsoft.PowerShell.Commands } else { - string message = String.Format( + string message = string.Format( CultureInfo.CurrentCulture, CertificateProviderStrings.RemoveStoreTemplate, storeName); @@ -1766,7 +1766,7 @@ namespace Microsoft.PowerShell.Commands action = CertificateProviderStrings.Action_Remove; } - string resource = String.Format( + string resource = string.Format( CultureInfo.CurrentCulture, CertificateProviderStrings.RemoveItemTemplate, sourcePath); @@ -2491,7 +2491,7 @@ namespace Microsoft.PowerShell.Commands if (s_storeCache != null) { if (s_storeCache.Location != storeLocation || - !String.Equals( + !string.Equals( s_storeCache.StoreName, storeName, StringComparison.OrdinalIgnoreCase)) @@ -2732,12 +2732,12 @@ namespace Microsoft.PowerShell.Commands } else { - return String.Empty; + return string.Empty; } if (string.IsNullOrEmpty(verb) || string.IsNullOrEmpty(noun)) { - return String.Empty; + return string.Empty; } // @@ -2764,10 +2764,10 @@ namespace Microsoft.PowerShell.Commands nsMgr.AddNamespace("command", HelpCommentsParser.commandURI); // Compose XPath query to select the appropriate node based on the cmdlet - string xpathQuery = String.Format( + string xpathQuery = string.Format( CultureInfo.InvariantCulture, HelpCommentsParser.ProviderHelpCommandXPath, - String.Empty, + string.Empty, verb, noun); @@ -2780,34 +2780,34 @@ namespace Microsoft.PowerShell.Commands } catch (XmlException) { - return String.Empty; + return string.Empty; } catch (PathTooLongException) { - return String.Empty; + return string.Empty; } catch (IOException) { - return String.Empty; + return string.Empty; } catch (UnauthorizedAccessException) { - return String.Empty; + return string.Empty; } catch (NotSupportedException) { - return String.Empty; + return string.Empty; } catch (SecurityException) { - return String.Empty; + return string.Empty; } catch (XPathException) { - return String.Empty; + return string.Empty; } - return String.Empty; + return string.Empty; } #endregion @@ -2922,7 +2922,7 @@ namespace Microsoft.PowerShell.Commands { // OID strings only contain numbers and periods - if (String.Equals(_oid, keyUsage._oid, StringComparison.Ordinal)) + if (string.Equals(_oid, keyUsage._oid, StringComparison.Ordinal)) { match = true; } @@ -3041,7 +3041,7 @@ namespace Microsoft.PowerShell.Commands //obtained pathElements[2] is MY //obtained pathElements[3] is HashID - bool fUserContext = String.Equals(pathElements[1], "Certificate::CurrentUser", StringComparison.OrdinalIgnoreCase); + bool fUserContext = string.Equals(pathElements[1], "Certificate::CurrentUser", StringComparison.OrdinalIgnoreCase); X509StoreLocation storeLocation = new X509StoreLocation(fUserContext ? StoreLocation.CurrentUser : StoreLocation.LocalMachine); @@ -3101,7 +3101,7 @@ namespace Microsoft.PowerShell.Commands foreach (string e in allElts) { - if ((e == ".") || (e == String.Empty)) + if ((e == ".") || (e == string.Empty)) { continue; } diff --git a/src/Microsoft.PowerShell.Security/security/CmsCommands.cs b/src/Microsoft.PowerShell.Security/security/CmsCommands.cs index 01ebeb166..9655c0352 100644 --- a/src/Microsoft.PowerShell.Security/security/CmsCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/CmsCommands.cs @@ -94,11 +94,11 @@ namespace Microsoft.PowerShell.Commands // Ensure the path is a single path from the file system provider if ((resolvedPaths.Count > 1) || - (!String.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) + (!string.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) { ErrorRecord error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, CmsCommands.FilePathMustBeFileSystemPath, Path)), "FilePathMustBeFileSystemPath", ErrorCategory.ObjectNotFound, provider); ThrowTerminatingError(error); @@ -128,7 +128,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - if (String.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { _inputObjects.Add(Content); } @@ -245,11 +245,11 @@ namespace Microsoft.PowerShell.Commands // Ensure the path is a single path from the file system provider if ((resolvedPaths.Count > 1) || - (!String.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) + (!string.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) { ErrorRecord error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, CmsCommands.FilePathMustBeFileSystemPath, Path)), "FilePathMustBeFileSystemPath", ErrorCategory.ObjectNotFound, provider); ThrowTerminatingError(error); @@ -273,7 +273,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - if (String.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { if (_contentBuffer.Length > 0) { @@ -292,7 +292,7 @@ namespace Microsoft.PowerShell.Commands string actualContent = null; // Read in the content - if (String.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { actualContent = _contentBuffer.ToString(); } @@ -423,11 +423,11 @@ namespace Microsoft.PowerShell.Commands // Ensure the path is a single path from the file system provider if ((resolvedPaths.Count > 1) || - (!String.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) + (!string.Equals(provider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase))) { ErrorRecord error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, CmsCommands.FilePathMustBeFileSystemPath, Path)), "FilePathMustBeFileSystemPath", ErrorCategory.ObjectNotFound, provider); ThrowTerminatingError(error); @@ -452,7 +452,7 @@ namespace Microsoft.PowerShell.Commands protected override void ProcessRecord() { // If we're process by content, collect it. - if (String.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { if (_contentBuffer.Length > 0) { @@ -463,7 +463,7 @@ namespace Microsoft.PowerShell.Commands } // If we're processing event log records, decrypt those inline. - if (String.Equals("ByWinEvent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByWinEvent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { string actualContent = EventLogRecord.Properties["Message"].Value.ToString(); string decrypted = Decrypt(actualContent); @@ -487,7 +487,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void EndProcessing() { - if (String.Equals("ByWinEvent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByWinEvent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { return; } @@ -495,7 +495,7 @@ namespace Microsoft.PowerShell.Commands string actualContent = null; // Read in the content - if (String.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ByContent", this.ParameterSetName, StringComparison.OrdinalIgnoreCase)) { actualContent = _contentBuffer.ToString(); } @@ -517,7 +517,7 @@ namespace Microsoft.PowerShell.Commands { ErrorRecord error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, CmsCommands.InputContainedNoEncryptedContentIncludeContext, "-IncludeContext")), "InputContainedNoEncryptedContentIncludeContext", ErrorCategory.ObjectNotFound, null); ThrowTerminatingError(error); diff --git a/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs b/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs index 8f943cdc5..eab9303aa 100644 --- a/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs @@ -216,7 +216,7 @@ namespace Microsoft.PowerShell.Commands if (ExecutionPolicy != ExecutionPolicy.Undefined) { string effectiveExecutionPolicy = SecuritySupport.GetExecutionPolicy(shellId).ToString(); - if (!String.Equals(effectiveExecutionPolicy, executionPolicy, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(effectiveExecutionPolicy, executionPolicy, StringComparison.OrdinalIgnoreCase)) { string message = StringUtil.Format(ExecutionPolicyCommands.ExecutionPolicyOverridden, effectiveExecutionPolicy); string recommendedAction = ExecutionPolicyCommands.ExecutionPolicyOverriddenRecommendedAction; diff --git a/src/Microsoft.PowerShell.Security/security/SecureStringCommands.cs b/src/Microsoft.PowerShell.Security/security/SecureStringCommands.cs index 16beea946..0c48cc78b 100644 --- a/src/Microsoft.PowerShell.Security/security/SecureStringCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/SecureStringCommands.cs @@ -173,7 +173,7 @@ namespace Microsoft.PowerShell.Commands { // The formatted string is Algorithm Version, // Initialization Vector, Encrypted Data - string dataPackage = String.Format( + string dataPackage = string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}|{1}|{2}", 2, diff --git a/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs b/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs index c6dea0181..47a3ba7c9 100644 --- a/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs @@ -379,7 +379,7 @@ namespace Microsoft.PowerShell.Commands { if (value == null) { - value = String.Empty; + value = string.Empty; } _timestampServer = value; @@ -550,7 +550,7 @@ namespace Microsoft.PowerShell.Commands if (SecurityUtils.GetFileSize(filePath) < 4) { // Note that the message param comes first - string message = String.Format( + string message = string.Format( System.Globalization.CultureInfo.CurrentCulture, UtilsStrings.FileSmallerThan4Bytes, filePath); @@ -621,7 +621,7 @@ namespace Microsoft.PowerShell.Commands { foreach (SigningOptionInfo si in s_sigOptionInfo) { - if (String.Equals(optionName, si.optionName, + if (string.Equals(optionName, si.optionName, StringComparison.OrdinalIgnoreCase)) { return si.option; diff --git a/src/Microsoft.WSMan.Management/ConfigProvider.cs b/src/Microsoft.WSMan.Management/ConfigProvider.cs index 0a3f2a7bd..1d68562c0 100644 --- a/src/Microsoft.WSMan.Management/ConfigProvider.cs +++ b/src/Microsoft.WSMan.Management/ConfigProvider.cs @@ -67,7 +67,7 @@ namespace Microsoft.WSMan.Management if (ChildIndex == -1) { //Means we are at host level, where no new-item is supported. Return empty string. - return String.Empty; + return string.Empty; } String child = path.Substring(ChildIndex + 1); @@ -82,7 +82,7 @@ namespace Microsoft.WSMan.Management case "Remove-Item": break; default: - return String.Empty; + return string.Empty; } // Load the help file from the current UI culture subfolder of the module's root folder @@ -110,7 +110,7 @@ namespace Microsoft.WSMan.Management if (helpFile == null) { //Can't find help file. Return empty string - return String.Empty; + return string.Empty; } try @@ -124,27 +124,27 @@ namespace Microsoft.WSMan.Management } catch(XmlException) { - return String.Empty; + return string.Empty; } catch(PathTooLongException) { - return String.Empty; + return string.Empty; } catch(IOException) { - return String.Empty; + return string.Empty; } catch(UnauthorizedAccessException) { - return String.Empty; + return string.Empty; } catch(NotSupportedException) { - return String.Empty; + return string.Empty; } catch(SecurityException) { - return String.Empty; + return string.Empty; } // Add the "msh" and "command" namespaces from the MAML schema @@ -169,7 +169,7 @@ namespace Microsoft.WSMan.Management } catch(XPathException) { - return String.Empty; + return string.Empty; } if (result != null) @@ -177,7 +177,7 @@ namespace Microsoft.WSMan.Management return result.ParentNode.OuterXml; } - return String.Empty; + return string.Empty; } #endregion @@ -210,7 +210,7 @@ namespace Microsoft.WSMan.Management protected override Collection InitializeDefaultDrives() { Collection drives = new Collection(); - drives.Add(new PSDriveInfo(WSManStringLiterals.rootpath, ProviderInfo, String.Empty, + drives.Add(new PSDriveInfo(WSManStringLiterals.rootpath, ProviderInfo, string.Empty, helper.GetResourceMsgFromResourcetext("ConfigStorage"), null)); return drives; } @@ -239,9 +239,9 @@ namespace Microsoft.WSMan.Management protected override string GetChildName(string path) { - string result = String.Empty; + string result = string.Empty; int separatorIndex = path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator); - string hostname = String.Empty; + string hostname = string.Empty; if (separatorIndex == -1) { result = path; @@ -352,8 +352,8 @@ namespace Microsoft.WSMan.Management /// protected override bool HasChildItems(string path) { - string childname = String.Empty; - string strPathCheck = String.Empty; + string childname = string.Empty; + string strPathCheck = string.Empty; if (path.Length == 0 && string.IsNullOrEmpty(childname)) { @@ -807,7 +807,7 @@ namespace Microsoft.WSMan.Management WsManElementObjectTypes.WSManConfigLeafElement); String pathToAdd = - String.Format( + string.Format( CultureInfo.InvariantCulture, "{0}{1}{2}", path, @@ -927,14 +927,14 @@ namespace Microsoft.WSMan.Management // If validation is not required, that means Clear-Item cmdlet is called. // Clear-Item is not allowed on RunAsPassword, Admin should call Clear-Item RunAsUser // if he intends to disable RunAs on the Plugin. - if(String.Equals(ChildName, WSManStringLiterals.ConfigRunAsPasswordName, StringComparison.OrdinalIgnoreCase)) + if(string.Equals(ChildName, WSManStringLiterals.ConfigRunAsPasswordName, StringComparison.OrdinalIgnoreCase)) { AssertError(helper.GetResourceMsgFromResourcetext("ClearItemOnRunAsPassword"), false); return; } } - string whatIfMessage = String.Format(CultureInfo.CurrentUICulture, helper.GetResourceMsgFromResourcetext("SetItemWhatIfAndConfirmText"), path, value); + string whatIfMessage = string.Format(CultureInfo.CurrentUICulture, helper.GetResourceMsgFromResourcetext("SetItemWhatIfAndConfirmText"), path, value); if (!ShouldProcess(whatIfMessage, string.Empty, string.Empty)) { return; @@ -1050,7 +1050,7 @@ namespace Microsoft.WSMan.Management { if(string.IsNullOrEmpty( pluginConfiguration.GetOneConfiguration( - String.Format( + string.Format( CultureInfo.InvariantCulture, "./attribute::{0}", WSManStringLiterals.ConfigRunAsUserName)))) @@ -1106,7 +1106,7 @@ namespace Microsoft.WSMan.Management { if (sResourceDirName.Equals(p.Properties["ResourceDir"].Value.ToString(), StringComparison.OrdinalIgnoreCase)) { - string xpathToUse = String.Format( + string xpathToUse = string.Format( CultureInfo.InvariantCulture, "{0}:{1}/{0}:{2}[attribute::{3}='{4}']", CurrentConfigurations.DefaultNameSpacePrefix, @@ -1155,7 +1155,7 @@ namespace Microsoft.WSMan.Management if (!Force) { string query = helper.GetResourceMsgFromResourcetext("ShouldContinueSecurityQuery"); - query = String.Format(CultureInfo.CurrentCulture, query, currentpluginname); + query = string.Format(CultureInfo.CurrentCulture, query, currentpluginname); if (!ShouldContinue(query, helper.GetResourceMsgFromResourcetext("ShouldContinueSecurityCaption"))) { return; @@ -1163,7 +1163,7 @@ namespace Microsoft.WSMan.Management } //NameSpace:Resources/NameSpace:Resource[@ResourceUri={''}]/NameSpace:Security[@Uri='{2}'] - string xpathToUse = String.Format( + string xpathToUse = string.Format( CultureInfo.InvariantCulture, "{0}:{1}/{0}:{2}[@{6}='{7}']/{0}:{3}[@{4}='{5}']", CurrentConfigurations.DefaultNameSpacePrefix, @@ -1188,7 +1188,7 @@ namespace Microsoft.WSMan.Management { if (p.Properties[ChildName] != null) { - string xpathToUse = String.Format( + string xpathToUse = string.Format( CultureInfo.InvariantCulture, "{0}:{1}/{0}:{2}[@{3}='{4}']", CurrentConfigurations.DefaultNameSpacePrefix, @@ -1205,7 +1205,7 @@ namespace Microsoft.WSMan.Management } else if (path.EndsWith(strPathChk + WSManStringLiterals.containerQuotasParameters, StringComparison.OrdinalIgnoreCase)) { - string xpathToUse = String.Format( + string xpathToUse = string.Format( CultureInfo.InvariantCulture, "{0}:{1}", CurrentConfigurations.DefaultNameSpacePrefix, @@ -1223,7 +1223,7 @@ namespace Microsoft.WSMan.Management } string pathForGlobalQuota = - String.Format( + string.Format( CultureInfo.InvariantCulture, @"{0}:\{1}\{2}\{3}", WSManStringLiterals.rootpath, @@ -1231,12 +1231,12 @@ namespace Microsoft.WSMan.Management WSManStringLiterals.containerShell, adjustedChileName); - warningMessage.Add(String.Format(helper.GetResourceMsgFromResourcetext("SetItemWarnigForPPQ"), pathForGlobalQuota)); + warningMessage.Add(string.Format(helper.GetResourceMsgFromResourcetext("SetItemWarnigForPPQ"), pathForGlobalQuota)); } } SessionObjCache.TryGetValue(host, out sessionobj); - string resourceUri = String.Format( + string resourceUri = string.Format( CultureInfo.InvariantCulture, "{0}?Name={1}", uri, @@ -1255,7 +1255,7 @@ namespace Microsoft.WSMan.Management } else { - warningMessage.Add(String.Format(helper.GetResourceMsgFromResourcetext("SetItemServiceRestartWarningRemote"), host)); + warningMessage.Add(string.Format(helper.GetResourceMsgFromResourcetext("SetItemServiceRestartWarningRemote"), host)); } } } @@ -1337,7 +1337,7 @@ namespace Microsoft.WSMan.Management if (globalWarningUris.Contains(uri) && globalWarningConfigurations.Contains(ChildName.ToLowerInvariant())) { - warningMessage.Add(String.Format(helper.GetResourceMsgFromResourcetext("SetItemWarningForGlobalQuota"), value)); + warningMessage.Add(string.Format(helper.GetResourceMsgFromResourcetext("SetItemWarningForGlobalQuota"), value)); } } @@ -1431,8 +1431,8 @@ namespace Microsoft.WSMan.Management protected override bool IsItemContainer(string path) { - string childname = String.Empty; - string strPathCheck = String.Empty; + string childname = string.Empty; + string strPathCheck = string.Empty; if (path.Length == 0 && string.IsNullOrEmpty(childname)) { @@ -1639,7 +1639,7 @@ namespace Microsoft.WSMan.Management return; } - String ChildName = String.Empty; + String ChildName = string.Empty; if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { @@ -1691,8 +1691,8 @@ namespace Microsoft.WSMan.Management path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); } - string inputStr = String.Empty; - string strPathCheck = String.Empty; + string inputStr = string.Empty; + string strPathCheck = string.Empty; strPathCheck = host + WSManStringLiterals.DefaultPathSeparator; if (path.Contains(strPathCheck + WSManStringLiterals.containerPlugin))//(path.Contains(@"\plugin")) @@ -1812,7 +1812,7 @@ namespace Microsoft.WSMan.Management /// protected override void NewItem(string path, string itemTypeName, object newItemValue) { - string inputStr = String.Empty; + string inputStr = string.Empty; object sessionobj; //if endswith '\', removes it. @@ -2061,7 +2061,7 @@ namespace Microsoft.WSMan.Management { PSObject mshObj = new PSObject(); string PluginName = string.Empty; - string inputStr = String.Empty; + string inputStr = string.Empty; string strPathChk = host + WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerPlugin; if (!path.Equals(strPathChk)) @@ -2139,7 +2139,7 @@ namespace Microsoft.WSMan.Management else {// to create an internal item of as plugin string pName = string.Empty; - string NewItem = String.Empty; + string NewItem = string.Empty; string[] Keys = null; int pos = path.LastIndexOf(strPathChk + WSManStringLiterals.DefaultPathSeparator, StringComparison.OrdinalIgnoreCase) + strPathChk.Length + 1; @@ -2208,7 +2208,7 @@ namespace Microsoft.WSMan.Management if (!Force) { string query = helper.GetResourceMsgFromResourcetext("ShouldContinueSecurityQuery"); - query = String.Format(CultureInfo.CurrentCulture, query, pName); + query = string.Format(CultureInfo.CurrentCulture, query, pName); if (!ShouldContinue(query, helper.GetResourceMsgFromResourcetext("ShouldContinueSecurityCaption"))) { return; @@ -2427,8 +2427,8 @@ namespace Microsoft.WSMan.Management private string GetInputStringForCreate(string ResourceURI, Hashtable value, string host) { - string putstr = String.Empty; - string nilns = String.Empty; + string putstr = string.Empty; + string nilns = string.Empty; StringBuilder sbvalues = new StringBuilder(); if (value.Count > 0) @@ -2467,7 +2467,7 @@ namespace Microsoft.WSMan.Management /// private string ReadFile(string path) { - string putstr = String.Empty; + string putstr = string.Empty; try { string filePath = this.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path); @@ -2623,7 +2623,7 @@ namespace Microsoft.WSMan.Management XmlNodeList nodes = null; try { - string xpathString = String.Empty; + string xpathString = string.Empty; if (ResourceURI.EndsWith(WSManStringLiterals.containerWinrs, StringComparison.OrdinalIgnoreCase)) { if (path.Equals(host + WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerShell, StringComparison.OrdinalIgnoreCase)) @@ -2729,7 +2729,7 @@ namespace Microsoft.WSMan.Management { ResourceURI = GetURIWithFilter(ResourceURI, cmdlinevalues); - string returnValue = String.Empty; + string returnValue = string.Empty; if (!this.getMapping.TryGetValue(ResourceURI, out returnValue)) { @@ -2912,7 +2912,7 @@ namespace Microsoft.WSMan.Management private bool ContainResourceValue(object sessionobj, string ResourceURI, string childname, string path, string host) { bool result = false; - string valuexml = String.Empty; + string valuexml = string.Empty; try { if (ResourceURI.Contains(WSManStringLiterals.containerListener) || ResourceURI.Contains(WSManStringLiterals.containerPlugin) || ResourceURI.Contains(WSManStringLiterals.containerCertMapping)) @@ -3333,7 +3333,7 @@ namespace Microsoft.WSMan.Management private string SetSchemaPath(string uri) { - string schemapath = String.Empty; + string schemapath = string.Empty; uri = uri.Remove(0, WinrmRootName[0].Length); if (uri.Contains(WSManStringLiterals.containerPlugin)) { @@ -3498,7 +3498,7 @@ namespace Microsoft.WSMan.Management } else if (path.Contains(strPathchk + WSManStringLiterals.containerPlugin)) { - string currentpluginname = String.Empty; + string currentpluginname = string.Empty; GetPluginNames(outxml, out objPluginNames, out currentpluginname, path); if (path.EndsWith(strPathchk + WSManStringLiterals.containerPlugin, StringComparison.OrdinalIgnoreCase)) { @@ -3532,7 +3532,7 @@ namespace Microsoft.WSMan.Management strPathchk = strPathchk + WSManStringLiterals.containerResources + WSManStringLiterals.DefaultPathSeparator; int Sepindex = path.IndexOf(WSManStringLiterals.DefaultPathSeparator, strPathchk.Length); - string sResourceDirName = String.Empty; + string sResourceDirName = string.Empty; if (Sepindex == -1) { sResourceDirName = path.Substring(strPathchk.Length); @@ -3656,7 +3656,7 @@ namespace Microsoft.WSMan.Management XmlDocument outxml = FindResourceValue(sessionobj, uri, null); if (outxml != null) { - string currentPluginName = String.Empty; + string currentPluginName = string.Empty; GetPluginNames(outxml, out objPluginNames, out currentPluginName, path); if (path.EndsWith(hostname + WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerPlugin + WSManStringLiterals.DefaultPathSeparator + currentPluginName, StringComparison.OrdinalIgnoreCase)) { @@ -3731,7 +3731,7 @@ namespace Microsoft.WSMan.Management private void GetChildItemOrNamesForListenerOrCertMapping(XmlDocument xmlResource, string ListenerOrCerMapping, string path, string host, ProviderMethods methodname, bool recurse) { Hashtable Objcache, Keyscache; - string PathEnd = String.Empty; + string PathEnd = string.Empty; if (ListenerOrCerMapping.Equals(WSManStringLiterals.containerClientCertificate)) { ProcessCertMappingObjects(xmlResource, out Objcache, out Keyscache); @@ -3888,7 +3888,7 @@ namespace Microsoft.WSMan.Management if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); - string ChildName = String.Empty; + string ChildName = string.Empty; string strpathChk = string.Empty; if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) @@ -3949,7 +3949,7 @@ namespace Microsoft.WSMan.Management } XmlDocument outxml = FindResourceValue(sessionobj, uri, null); - string currentpluginname = String.Empty; + string currentpluginname = string.Empty; GetPluginNames(outxml, out objPluginNames, out currentpluginname, path); if (string.IsNullOrEmpty(currentpluginname)) { @@ -4277,7 +4277,7 @@ namespace Microsoft.WSMan.Management } else if (path.Contains(strPathchk + WSManStringLiterals.containerPlugin)) { - string currentpluginname = String.Empty; + string currentpluginname = string.Empty; GetPluginNames(outxml, out objPluginNames, out currentpluginname, path); if (path.EndsWith(strPathchk + WSManStringLiterals.containerPlugin, StringComparison.OrdinalIgnoreCase)) { @@ -4343,7 +4343,7 @@ namespace Microsoft.WSMan.Management foreach (XmlAttribute attrOfQuotas in pluginQuotas.Attributes) { String pathToAdd = - String.Format( + string.Format( CultureInfo.InvariantCulture, "{0}{1}{2}", path, @@ -4401,7 +4401,7 @@ namespace Microsoft.WSMan.Management strPathchk = strPathchk + WSManStringLiterals.containerResources + WSManStringLiterals.DefaultPathSeparator; int Sepindex = path.IndexOf(WSManStringLiterals.DefaultPathSeparator, strPathchk.Length); - string sResourceDirName = String.Empty; + string sResourceDirName = string.Empty; if (Sepindex == -1) { sResourceDirName = path.Substring(strPathchk.Length); @@ -4553,7 +4553,7 @@ namespace Microsoft.WSMan.Management private int GetPluginNames(XmlDocument xmlPlugins, out PSObject PluginNames, out string CurrentPluginName, string path) { PluginNames = new PSObject(); - CurrentPluginName = String.Empty; + CurrentPluginName = string.Empty; // If the execution is reached this point ... that means the path should for plugins directory (..\Plugins...). if (!path.Contains(WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerPlugin)) @@ -4718,7 +4718,7 @@ namespace Microsoft.WSMan.Management private void GenerateObjectNameAndKeys(Hashtable InputAttributes, string ResourceURI, string ContainerItem, out string ItemName, out string[] keys) { StringBuilder sbHashKey = new StringBuilder(); - string keysColumns = String.Empty; + string keysColumns = string.Empty; foreach (DictionaryEntry attribute in InputAttributes) { if (IsPKey(attribute.Key.ToString(), ResourceURI)) @@ -4765,7 +4765,7 @@ namespace Microsoft.WSMan.Management Hashtable InputAttributes = new Hashtable(); PSObject objCerts = new PSObject(); string[] keys = null; - string ItemName = String.Empty; + string ItemName = string.Empty; foreach (XmlNode childnode in node.ChildNodes) { // if (childnode.LocalName.Equals("URI")) @@ -4823,7 +4823,7 @@ namespace Microsoft.WSMan.Management Hashtable InputAttributes = new Hashtable(); PSObject objListener = new PSObject(); string[] Keys = null; - string ItemName = String.Empty; + string ItemName = string.Empty; foreach (XmlNode childnode in node.ChildNodes) { //if (childnode.LocalName.Equals("Address")) @@ -4884,7 +4884,7 @@ namespace Microsoft.WSMan.Management for (int i = 0; i <= attributecol.Count - 1; i++) { - if (String.Equals(attributecol[i].LocalName, WSManStringLiterals.ConfigRunAsPasswordName, StringComparison.OrdinalIgnoreCase) + if (string.Equals(attributecol[i].LocalName, WSManStringLiterals.ConfigRunAsPasswordName, StringComparison.OrdinalIgnoreCase) && runAsUserPresent && setRunasPasswordAsSecureString) { @@ -4926,7 +4926,7 @@ namespace Microsoft.WSMan.Management XmlAttributeCollection attributecol = xe.Attributes; bool ExactMatchFound = false; bool SupportsOptionsFound = false; - string resourceUri = String.Empty; + string resourceUri = string.Empty; for (int i = 0; i <= attributecol.Count - 1; i++) { @@ -5009,8 +5009,8 @@ namespace Microsoft.WSMan.Management { PSObject objInitParam = new PSObject(); XmlAttributeCollection attributecol = xe.Attributes; - String Name = String.Empty; - String Value = String.Empty; + String Name = string.Empty; + String Value = string.Empty; for (int i = 0; i <= attributecol.Count - 1; i++) { if (attributecol[i].LocalName.Equals("Name", StringComparison.OrdinalIgnoreCase)) @@ -5103,7 +5103,7 @@ namespace Microsoft.WSMan.Management sbvalues.Append(""); } diff --git a/src/Microsoft.WSMan.Management/CurrentConfigurations.cs b/src/Microsoft.WSMan.Management/CurrentConfigurations.cs index aa41752d6..86470c879 100644 --- a/src/Microsoft.WSMan.Management/CurrentConfigurations.cs +++ b/src/Microsoft.WSMan.Management/CurrentConfigurations.cs @@ -181,7 +181,7 @@ namespace Microsoft.WSMan.Management } } - XmlNode attr = this.rootDocument.CreateNode(XmlNodeType.Attribute, configurationName, String.Empty); + XmlNode attr = this.rootDocument.CreateNode(XmlNodeType.Attribute, configurationName, string.Empty); attr.Value = configurationValue; nodeToUpdate.Attributes.SetNamedItem(attr); diff --git a/src/Microsoft.WSMan.Management/PingWSMan.cs b/src/Microsoft.WSMan.Management/PingWSMan.cs index a360bbfb4..43737250f 100644 --- a/src/Microsoft.WSMan.Management/PingWSMan.cs +++ b/src/Microsoft.WSMan.Management/PingWSMan.cs @@ -141,7 +141,7 @@ namespace Microsoft.WSMan.Management WSManHelper helper = new WSManHelper(this); IWSManEx wsmanObject = (IWSManEx)new WSManClass(); - string connectionStr = String.Empty; + string connectionStr = string.Empty; connectionStr = helper.CreateConnectionString(null, port, computername, applicationname); IWSManSession m_SessionObj = null; try diff --git a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs index 3c21ac6a7..dcd06acfe 100644 --- a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs +++ b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs @@ -131,7 +131,7 @@ namespace Microsoft.WSMan.Management } else { - string openAllProfiles = skipNetworkProfileCheck ? "" : String.Empty; + string openAllProfiles = skipNetworkProfileCheck ? "" : string.Empty; analysisInputXml = @"" + transport + "" + openAllProfiles + ""; action = "Analyze"; } diff --git a/src/Microsoft.WSMan.Management/WSManInstance.cs b/src/Microsoft.WSMan.Management/WSManInstance.cs index d464da8aa..3a958847e 100644 --- a/src/Microsoft.WSMan.Management/WSManInstance.cs +++ b/src/Microsoft.WSMan.Management/WSManInstance.cs @@ -906,7 +906,7 @@ namespace Microsoft.WSMan.Management try { - string connectionStr = String.Empty; + string connectionStr = string.Empty; connectionStr = helper.CreateConnectionString(connectionuri, port, computername, applicationname); if (connectionuri != null) { @@ -1204,7 +1204,7 @@ namespace Microsoft.WSMan.Management IWSManSession m_session = null; try { - string connectionStr = String.Empty; + string connectionStr = string.Empty; connectionStr = helper.CreateConnectionString(connectionuri, port, computername, applicationname); if (connectionuri != null) { @@ -1490,7 +1490,7 @@ namespace Microsoft.WSMan.Management private WSManHelper helper; IWSManEx m_wsmanObject = (IWSManEx)new WSManClass(); IWSManSession m_session = null; - string connectionStr = String.Empty; + string connectionStr = string.Empty; /// /// BeginProcessing method. diff --git a/src/Microsoft.WSMan.Management/WsManHelper.cs b/src/Microsoft.WSMan.Management/WsManHelper.cs index fbc90c29e..06f2a4bb0 100644 --- a/src/Microsoft.WSMan.Management/WsManHelper.cs +++ b/src/Microsoft.WSMan.Management/WsManHelper.cs @@ -192,7 +192,7 @@ namespace Microsoft.WSMan.Management string result = null; if (template != null) { - result = String.Format(CultureInfo.CurrentCulture, + result = string.Format(CultureInfo.CurrentCulture, template, args); } @@ -303,7 +303,7 @@ namespace Microsoft.WSMan.Management if (operation.Equals("invoke", StringComparison.OrdinalIgnoreCase)) { sfx = "_INPUT"; - resultStr = String.Concat(actionStr, sfx); + resultStr = string.Concat(actionStr, sfx); } else { @@ -1096,7 +1096,7 @@ namespace Microsoft.WSMan.Management #if CORECLR "0409" /* TODO: don't assume it is always English on CSS? */ #else - String.Concat("0", String.Format(CultureInfo.CurrentCulture, "{0:x2}", checked((uint)CultureInfo.CurrentUICulture.LCID))) + string.Concat("0", string.Format(CultureInfo.CurrentCulture, "{0:x2}", checked((uint)CultureInfo.CurrentUICulture.LCID))) #endif + "\\" + "winrm.ini"; if (File.Exists(filepath)) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 4a972a857..1972c67d2 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -440,7 +440,7 @@ namespace System.Management.Automation catch (UnauthorizedAccessException) { // directory creation may fail if the account doesn't have filesystem permission such as some service accounts - folderPath = String.Empty; + folderPath = string.Empty; } } diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 4cbcfa94f..6117c462e 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -93,7 +93,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal if (cimPropertyInstance != null && cimPropertyInstance.CimClass != null && cimPropertyInstance.CimClass.CimSystemProperties != null && - String.Equals( + string.Equals( cimPropertyInstance.CimClass.CimSystemProperties.ClassName, "MSFT_Credential", StringComparison.OrdinalIgnoreCase)) { @@ -991,7 +991,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal /// Decoded string. public static string GetStringFromSecureString(SecureString value) { - string passwordValueToAdd = String.Empty; + string passwordValueToAdd = string.Empty; if (value != null) { @@ -1025,7 +1025,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal /// private static string GetModuleQualifiedResourceName(string moduleName, string moduleVersion, string className) { - return String.Format(CultureInfo.InvariantCulture, "{0}\\{1}\\{2}", moduleName, moduleVersion, className); + return string.Format(CultureInfo.InvariantCulture, "{0}\\{1}\\{2}", moduleName, moduleVersion, className); } /// @@ -1061,7 +1061,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal public static List GetCachedClassesForModule(PSModuleInfo module) { List cachedClasses = new List(); - var moduleQualifiedName = String.Format(CultureInfo.InvariantCulture, "{0}\\{1}", module.Name, module.Version.ToString()); + var moduleQualifiedName = string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", module.Name, module.Version.ToString()); foreach (var pair in ClassCache) { if (pair.Key.StartsWith(moduleQualifiedName, StringComparison.OrdinalIgnoreCase)) @@ -1368,7 +1368,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal if (runAsBehavior == DSCResourceRunAsCredential.NotSupported) { - if (String.Equals(prop.Name, "PsDscRunAsCredential", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(prop.Name, "PsDscRunAsCredential", StringComparison.OrdinalIgnoreCase)) { // skip adding PsDscRunAsCredential to the dynamic word for the dsc resource. continue; @@ -1433,7 +1433,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal // set the property to mandatory is specified for the resource. if (runAsBehavior == DSCResourceRunAsCredential.Mandatory) { - if (String.Equals(prop.Name, "PsDscRunAsCredential", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(prop.Name, "PsDscRunAsCredential", StringComparison.OrdinalIgnoreCase)) { keyProp.Mandatory = true; } @@ -2473,7 +2473,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal out embeddedInstanceType, embeddedInstanceTypes, ref enumNames); } - string arrayAffix = isArrayType ? "[]" : String.Empty; + string arrayAffix = isArrayType ? "[]" : string.Empty; sb.AppendFormat(CultureInfo.InvariantCulture, " {0}{1} {2}{3};\n", @@ -3032,7 +3032,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal string embeddedInstanceType; string mofType = MapTypeToMofType(memberType, member.Name, className, out isArrayType, out embeddedInstanceType, embeddedInstanceTypes); - string arrayAffix = isArrayType ? "[]" : String.Empty; + string arrayAffix = isArrayType ? "[]" : string.Empty; var enumNames = memberType.IsEnum ? Enum.GetNames(memberType) @@ -3200,7 +3200,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal foreach (var c in classes) { var alias = GetFriendlyName(c); - if (String.Equals(alias, resourceName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(alias, resourceName, StringComparison.OrdinalIgnoreCase)) { CreateAndRegisterKeywordFromCimClass(module.Name, module.Version, c, functionsToDefine, DSCResourceRunAsCredential.Default); return true; diff --git a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs index 8c824ad24..9e3fa89a1 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs @@ -372,7 +372,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { result.Word = sb.ToString(); sb.Clear(); - result.Delim = String.Empty; + result.Delim = string.Empty; yield return result; } @@ -383,7 +383,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } result.Word = sb.ToString(); - result.Delim = String.Empty; + result.Delim = string.Empty; yield return result; } diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs index 08fe9688a..191355369 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs @@ -367,12 +367,12 @@ namespace Microsoft.PowerShell.Commands.Internal.Format private bool MatchNodeNameHelper(XmlNode n, string s, bool allowAttributes) { bool match = false; - if (String.Equals(n.Name, s, StringComparison.Ordinal)) + if (string.Equals(n.Name, s, StringComparison.Ordinal)) { // we have a case sensitive match match = true; } - else if (String.Equals(n.Name, s, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(n.Name, s, StringComparison.OrdinalIgnoreCase)) { // try a case insensitive match // we differ only in case: flag this as an ERROR for the time being @@ -409,12 +409,12 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal bool MatchAttributeName(XmlAttribute a, string s) { - if (String.Equals(a.Name, s, StringComparison.Ordinal)) + if (string.Equals(a.Name, s, StringComparison.Ordinal)) { // we have a case sensitive match return true; } - else if (String.Equals(a.Name, s, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(a.Name, s, StringComparison.OrdinalIgnoreCase)) { // try a case insensitive match // we differ only in case: flag this as an ERROR for the time being diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/commands.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/commands.cs index 53bb79f5f..16caefe1f 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/commands.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/commands.cs @@ -15,19 +15,19 @@ namespace Microsoft.PowerShell.Commands internal static bool Convert(string expansionString, out EnumerableExpansion expansion) { expansion = EnumerableExpansion.EnumOnly; - if (String.Equals(expansionString, CoreOnlyString, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(expansionString, CoreOnlyString, StringComparison.OrdinalIgnoreCase)) { expansion = EnumerableExpansion.CoreOnly; return true; } - if (String.Equals(expansionString, EnumOnlyString, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(expansionString, EnumOnlyString, StringComparison.OrdinalIgnoreCase)) { expansion = EnumerableExpansion.EnumOnly; return true; } - if (String.Equals(expansionString, BothString, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(expansionString, BothString, StringComparison.OrdinalIgnoreCase)) { expansion = EnumerableExpansion.Both; return true; diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs index a37f475bc..482cf88b4 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs @@ -668,7 +668,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { if (x.controlBody.GetType() != controlReference.controlType) continue; - if (String.Compare(controlReference.name, x.name, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(controlReference.name, x.name, StringComparison.OrdinalIgnoreCase) == 0) return x.controlBody; } diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs index cef9125ae..263d03454 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs @@ -275,14 +275,14 @@ namespace Microsoft.PowerShell.Commands.Internal.Format foreach (TypeOrGroupReference currentTypeOrGroupReference in currentViewDefinition.appliesTo.referenceList) { if (!string.IsNullOrEmpty(currentTypeOrGroupReference.name) && - String.Equals(currentObjectTypeName, currentTypeOrGroupReference.name, StringComparison.OrdinalIgnoreCase)) + string.Equals(currentObjectTypeName, currentTypeOrGroupReference.name, StringComparison.OrdinalIgnoreCase)) { if (currentViewDefinition.mainControl.GetType() == formatType) { validViews.Append(currentViewDefinition.name); validViews.Append(separator); } - else if (String.Equals(viewName, currentViewDefinition.name, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(viewName, currentViewDefinition.name, StringComparison.OrdinalIgnoreCase)) { string cmdletFormatName = null; if (currentViewDefinition.mainControl is TableControlBody) diff --git a/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs b/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs index a63b39d14..6d32f26a4 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs @@ -32,7 +32,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { if (typeNames.Count < 2 || string.IsNullOrEmpty(typeNames[1])) return false; - return String.Equals(typeNames[1], "System.Enum", StringComparison.Ordinal); + return string.Equals(typeNames[1], "System.Enum", StringComparison.Ordinal); } /// @@ -411,14 +411,14 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (directive.formatString.Contains("{0") || directive.formatString.Contains("}")) { // we do have it, just use it - return String.Format(CultureInfo.CurrentCulture, directive.formatString, so); + return string.Format(CultureInfo.CurrentCulture, directive.formatString, so); } // we fall back to the PSObject's IFormattable.ToString() // pass a null IFormatProvider return so.ToString(directive.formatString, null); } catch (Exception e) // 2004/11/17-JonN This covers exceptions thrown in - // String.Format and PSObject.ToString(). + // string.Format and PSObject.ToString(). // I think we can swallow these. { // NOTE: we catch all the exceptions, since we do not know diff --git a/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs b/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs index 38b4be122..ee9c5155b 100644 --- a/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs +++ b/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs @@ -419,7 +419,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml if (prefix == null || prefix.Length == 0) { - return new XmlQualifiedName(_r.NameTable.Add(value), _r.LookupNamespace(String.Empty)); + return new XmlQualifiedName(_r.NameTable.Add(value), _r.LookupNamespace(string.Empty)); } else { diff --git a/src/System.Management.Automation/engine/AliasInfo.cs b/src/System.Management.Automation/engine/AliasInfo.cs index a3425bce2..9230b6abe 100644 --- a/src/System.Management.Automation/engine/AliasInfo.cs +++ b/src/System.Management.Automation/engine/AliasInfo.cs @@ -193,7 +193,7 @@ namespace System.Management.Automation } } - private string _definition = String.Empty; + private string _definition = string.Empty; /// /// Sets the new definition for the alias. @@ -331,7 +331,7 @@ namespace System.Management.Automation /// /// Gets or sets the description for the alias /// - public string Description { get; set; } = String.Empty; + public string Description { get; set; } = string.Empty; /// /// If ResolvedCommand returns null, this property will diff --git a/src/System.Management.Automation/engine/ApplicationInfo.cs b/src/System.Management.Automation/engine/ApplicationInfo.cs index 2d8469d09..3e3875a13 100644 --- a/src/System.Management.Automation/engine/ApplicationInfo.cs +++ b/src/System.Management.Automation/engine/ApplicationInfo.cs @@ -58,12 +58,12 @@ namespace System.Management.Automation /// /// Gets the path for the application file. /// - public string Path { get; } = String.Empty; + public string Path { get; } = string.Empty; /// /// Gets the extension of the application file. /// - public string Extension { get; } = String.Empty; + public string Extension { get; } = string.Empty; /// /// Gets the path of the application file. diff --git a/src/System.Management.Automation/engine/Attributes.cs b/src/System.Management.Automation/engine/Attributes.cs index 041e3af29..f7b0bb44b 100644 --- a/src/System.Management.Automation/engine/Attributes.cs +++ b/src/System.Management.Automation/engine/Attributes.cs @@ -396,7 +396,7 @@ namespace System.Management.Automation /// is specified. /// [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] - public string HelpUri { get; set; } = String.Empty; + public string HelpUri { get; set; } = string.Empty; /// /// Gets and sets the RemotingBehavior value that declares how this cmdlet should interact diff --git a/src/System.Management.Automation/engine/CmdletInfo.cs b/src/System.Management.Automation/engine/CmdletInfo.cs index d15dfe2e8..cb799b9f9 100644 --- a/src/System.Management.Automation/engine/CmdletInfo.cs +++ b/src/System.Management.Automation/engine/CmdletInfo.cs @@ -149,7 +149,7 @@ namespace System.Management.Automation } } - private string _verb = String.Empty; + private string _verb = string.Empty; /// /// Gets the noun of the cmdlet. @@ -162,7 +162,7 @@ namespace System.Management.Automation } } - private string _noun = String.Empty; + private string _noun = string.Empty; internal static bool SplitCmdletName(string name, out string verb, out string noun) { @@ -206,7 +206,7 @@ namespace System.Management.Automation } } - private string _helpFilePath = String.Empty; + private string _helpFilePath = string.Empty; internal override HelpCategory HelpCategory { @@ -296,7 +296,7 @@ namespace System.Management.Automation { synopsis.AppendLine(); synopsis.AppendLine( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, "{0}{1}{2} {3}", _verb, @@ -309,7 +309,7 @@ namespace System.Management.Automation { // Skip the synopsis documentation if the cmdlet hasn't been loaded yet. synopsis.AppendLine( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, "{0}{1}{2}", _verb, diff --git a/src/System.Management.Automation/engine/CmdletParameterBinderController.cs b/src/System.Management.Automation/engine/CmdletParameterBinderController.cs index cef43bed3..1054ce371 100644 --- a/src/System.Management.Automation/engine/CmdletParameterBinderController.cs +++ b/src/System.Management.Automation/engine/CmdletParameterBinderController.cs @@ -459,7 +459,7 @@ namespace System.Management.Automation // so we write out a warning and ignore this binding failure if (!_warningSet.Contains(_commandMetadata.Name + Separator + parameterName)) { - string message = String.Format(CultureInfo.InvariantCulture, + string message = string.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.FailToBindDefaultParameter, LanguagePrimitives.IsNull(argumentValue) ? "null" : argumentValue.ToString(), parameterName, ex.Message); @@ -731,7 +731,7 @@ namespace System.Management.Automation if (!_warningSet.Contains(cmdletName + Separator + parameterName)) { _commandRuntime.WriteWarning( - String.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.MultipleParametersMatched, parameterName)); + string.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.MultipleParametersMatched, parameterName)); _warningSet.Add(cmdletName + Separator + parameterName); } @@ -751,7 +751,7 @@ namespace System.Management.Automation if (!_warningSet.Contains(cmdletName + Separator + parameterName)) { _commandRuntime.WriteWarning( - String.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.DifferentValuesAssignedToSingleParameter, parameterName)); + string.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.DifferentValuesAssignedToSingleParameter, parameterName)); _warningSet.Add(cmdletName + Separator + parameterName); } @@ -777,7 +777,7 @@ namespace System.Management.Automation ? ParameterBinderStrings.MultipleKeysInBadFormat : ParameterBinderStrings.SingleKeyInBadFormat; _commandRuntime.WriteWarning( - String.Format(CultureInfo.InvariantCulture, formatString, keysInError)); + string.Format(CultureInfo.InvariantCulture, formatString, keysInError)); } foreach (MergedCompiledCommandParameter param in parametersToRemove) @@ -851,7 +851,7 @@ namespace System.Management.Automation if (writeWarning && !_warningSet.Contains(cmdletName + Separator + paramName)) { _commandRuntime.WriteWarning( - String.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.DifferentValuesAssignedToSingleParameter, paramName)); + string.Format(CultureInfo.InvariantCulture, ParameterBinderStrings.DifferentValuesAssignedToSingleParameter, paramName)); _warningSet.Add(cmdletName + Separator + paramName); } } @@ -1539,7 +1539,7 @@ namespace System.Management.Automation (flags & ParameterBindingFlags.IsDefaultValue) == 0 && !BoundObsoleteParameterNames.Contains(parameter.Parameter.Name)) { - string obsoleteWarning = String.Format( + string obsoleteWarning = string.Format( CultureInfo.InvariantCulture, ParameterBinderStrings.UseOfDeprecatedParameterWarning, parameter.Parameter.Name, @@ -4612,7 +4612,7 @@ namespace System.Management.Automation /// Return true if the key is valid, false if not. internal static bool CheckKeyIsValid(string key, ref string cmdletName, ref string parameterName) { - if (key == String.Empty) + if (key == string.Empty) { return false; } @@ -4673,7 +4673,7 @@ namespace System.Management.Automation index++; } - StringBuilder builder = new StringBuilder(String.Empty); + StringBuilder builder = new StringBuilder(string.Empty); for (; index < key.Length; index++) { if (quoteChar != '\0') diff --git a/src/System.Management.Automation/engine/CodeMethods.cs b/src/System.Management.Automation/engine/CodeMethods.cs index b4bf10f29..46202ee7e 100644 --- a/src/System.Management.Automation/engine/CodeMethods.cs +++ b/src/System.Management.Automation/engine/CodeMethods.cs @@ -25,17 +25,17 @@ namespace Microsoft.PowerShell public static string PropertyValueCollection(PSObject instance) { if (instance == null) - return String.Empty; + return string.Empty; var values = (PropertyValueCollection)instance.BaseObject; if (values == null) - return String.Empty; + return string.Empty; if (values.Count == 1) { if (values[0] == null) { - return String.Empty; + return string.Empty; } return (PSObject.AsPSObject(values[0]).ToString()); diff --git a/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs b/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs index f55323c55..780044c2e 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs @@ -126,7 +126,7 @@ namespace System.Management.Automation.ComInterop public void AddHandler(int dispid, object func) { - string name = String.Format(CultureInfo.InvariantCulture, "[DISPID={0}]", dispid); + string name = string.Format(CultureInfo.InvariantCulture, "[DISPID={0}]", dispid); lock (_lockObject) { @@ -151,7 +151,7 @@ namespace System.Management.Automation.ComInterop public void RemoveHandler(int dispid, object func) { - string name = String.Format(CultureInfo.InvariantCulture, "[DISPID={0}]", dispid); + string name = string.Format(CultureInfo.InvariantCulture, "[DISPID={0}]", dispid); lock (_lockObject) { diff --git a/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs index 3276b0abc..be1301f59 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs @@ -81,7 +81,7 @@ namespace System.Management.Automation.ComInterop /// TODO: Return values should be represented by a different type /// internal ComParamDesc(ref ELEMDESC elemDesc) - : this(ref elemDesc, String.Empty) + : this(ref elemDesc, string.Empty) { } diff --git a/src/System.Management.Automation/engine/ComInterop/ComTypeEnumDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComTypeEnumDesc.cs index 12634f019..d3454fe2a 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComTypeEnumDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComTypeEnumDesc.cs @@ -22,7 +22,7 @@ namespace System.Management.Automation.ComInterop public override string ToString() { - return String.Format(CultureInfo.CurrentCulture, "", TypeName); + return string.Format(CultureInfo.CurrentCulture, "", TypeName); } internal ComTypeEnumDesc(ComTypes.ITypeInfo typeInfo, ComTypeLibDesc typeLibDesc) : diff --git a/src/System.Management.Automation/engine/ComInterop/ComTypeLibDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComTypeLibDesc.cs index ce11420ff..48a3276cb 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComTypeLibDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComTypeLibDesc.cs @@ -38,13 +38,13 @@ namespace System.Management.Automation.ComInterop public override string ToString() { - return String.Format(CultureInfo.CurrentCulture, "", Name); + return string.Format(CultureInfo.CurrentCulture, "", Name); } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] public string Documentation { - get { return String.Empty; } + get { return string.Empty; } } #region IDynamicMetaObjectProvider Members diff --git a/src/System.Management.Automation/engine/ComInterop/DispCallable.cs b/src/System.Management.Automation/engine/ComInterop/DispCallable.cs index a12f6bd3b..c2da035a4 100644 --- a/src/System.Management.Automation/engine/ComInterop/DispCallable.cs +++ b/src/System.Management.Automation/engine/ComInterop/DispCallable.cs @@ -26,7 +26,7 @@ namespace System.Management.Automation.ComInterop public override string ToString() { - return String.Format(CultureInfo.CurrentCulture, "", MemberName); + return string.Format(CultureInfo.CurrentCulture, "", MemberName); } public IDispatchComObject DispatchComObject { get; } diff --git a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs index c012fc081..c5468343f 100644 --- a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs +++ b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs @@ -111,7 +111,7 @@ namespace System.Management.Automation.ComInterop typeName = "IDispatch"; } - return String.Format(CultureInfo.CurrentCulture, "{0} ({1})", RuntimeCallableWrapper.ToString(), typeName); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", RuntimeCallableWrapper.ToString(), typeName); } public ComTypeDesc ComTypeDesc @@ -254,7 +254,7 @@ namespace System.Management.Automation.ComInterop } else { - throw Error.CouldNotGetDispId(name, String.Format(CultureInfo.InvariantCulture, "0x{0:X})", hresult)); + throw Error.CouldNotGetDispId(name, string.Format(CultureInfo.InvariantCulture, "0x{0:X})", hresult)); } } @@ -293,7 +293,7 @@ namespace System.Management.Automation.ComInterop } else { - throw Error.CouldNotGetDispId(name, String.Format(CultureInfo.InvariantCulture, "0x{0:X})", hresult)); + throw Error.CouldNotGetDispId(name, string.Format(CultureInfo.InvariantCulture, "0x{0:X})", hresult)); } } diff --git a/src/System.Management.Automation/engine/ComInterop/Variant.cs b/src/System.Management.Automation/engine/ComInterop/Variant.cs index fe8bb5710..e64c6bd08 100644 --- a/src/System.Management.Automation/engine/ComInterop/Variant.cs +++ b/src/System.Management.Automation/engine/ComInterop/Variant.cs @@ -136,7 +136,7 @@ namespace System.Management.Automation.ComInterop public override string ToString() { - return String.Format(CultureInfo.CurrentCulture, "Variant ({0})", VariantType); + return string.Format(CultureInfo.CurrentCulture, "Variant ({0})", VariantType); } /// diff --git a/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs b/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs index edcdd4d35..442065f8e 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs @@ -992,7 +992,7 @@ namespace System.Management.Automation result.AddRange(s1); for (int i = 0, j = 0; i < s2.Count; ++i) { - if (j < s1.Count && String.Compare(s2[i].Path, s1[j].Path, StringComparison.CurrentCultureIgnoreCase) == 0) + if (j < s1.Count && string.Compare(s2[i].Path, s1[j].Path, StringComparison.CurrentCultureIgnoreCase) == 0) { ++j; continue; @@ -1086,14 +1086,14 @@ namespace System.Management.Automation // It's OK to use script, since tab completion is useless when the remote Win7 machine is in nolanguage mode if (!shouldFullyQualifyPaths) { - powershell.AddScript(String.Format( + powershell.AddScript(string.Format( CultureInfo.InvariantCulture, "& {{ trap {{ continue }} ; resolve-path {0} -Relative -WarningAction SilentlyContinue | ForEach-Object {{,($_,(get-item $_ -WarningAction SilentlyContinue),(convert-path $_ -WarningAction SilentlyContinue))}} }}", path)); } else { - powershell.AddScript(String.Format( + powershell.AddScript(string.Format( CultureInfo.InvariantCulture, "& {{ trap {{ continue }} ; resolve-path {0} -WarningAction SilentlyContinue | ForEach-Object {{,($_,(get-item $_ -WarningAction SilentlyContinue),(convert-path $_ -WarningAction SilentlyContinue))}} }}", path)); diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs index 4dc2fc064..501056fbe 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs @@ -611,7 +611,7 @@ namespace System.Management.Automation else { IScriptPosition cursor = completionContext.CursorPosition; - bool isCursorLineEmpty = String.IsNullOrWhiteSpace(cursor.Line); + bool isCursorLineEmpty = string.IsNullOrWhiteSpace(cursor.Line); var tokenBeforeCursor = completionContext.TokenBeforeCursor; bool isLineContinuationBeforeCursor = false; if (tokenBeforeCursor != null) @@ -874,7 +874,7 @@ namespace System.Management.Automation if (keywordAst != null) { // Handle only empty line - if (String.IsNullOrWhiteSpace(cursor.Line)) + if (string.IsNullOrWhiteSpace(cursor.Line)) { // Check if the cursor outside of last child of hashtable and within the hashtable if (cursor.Offset > lastChildofHashtableAst.Extent.EndOffset && @@ -1057,14 +1057,14 @@ namespace System.Management.Automation { List existingValues = null; WildcardPattern wildcardPattern = null; - bool isDependsOnProperty = String.Equals(property.Name, @"DependsOn", StringComparison.OrdinalIgnoreCase); + bool isDependsOnProperty = string.Equals(property.Name, @"DependsOn", StringComparison.OrdinalIgnoreCase); bool hasNewLine = false; string stringQuote = (completionContext.TokenAtCursor is StringExpandableToken) ? "\"" : "'"; if ((property.ValueMap != null && property.ValueMap.Count > 0) || isDependsOnProperty) { shouldContinue = false; existingValues = new List(); - if (String.Equals(property.TypeConstraint, "StringArray", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(property.TypeConstraint, "StringArray", StringComparison.OrdinalIgnoreCase)) { var arrayAst = Ast.GetAncestorAst(lastAst); if (arrayAst != null && arrayAst.Elements.Count > 0) @@ -1144,7 +1144,7 @@ namespace System.Management.Automation var dynamicKeywordAst = statementAst as DynamicKeywordStatementAst; if (dynamicKeywordAst != null && dynamicKeywordAst != keywordAst && - !String.Equals(dynamicKeywordAst.Keyword.Keyword, @"Node", StringComparison.OrdinalIgnoreCase)) + !string.Equals(dynamicKeywordAst.Keyword.Keyword, @"Node", StringComparison.OrdinalIgnoreCase)) { if (!string.IsNullOrEmpty(dynamicKeywordAst.ElementName)) { @@ -1360,7 +1360,7 @@ namespace System.Management.Automation IEnumerable keywords = configureAst.DefinedKeywords.Where( k => // Node is special case, legal in both Resource and Meta configuration - String.Compare(k.Keyword, @"Node", StringComparison.OrdinalIgnoreCase) == 0 || + string.Compare(k.Keyword, @"Node", StringComparison.OrdinalIgnoreCase) == 0 || ( // Check compatibility between Resource and Configuration Type k.IsCompatibleWithConfigurationType(configureAst.ConfigurationType) && @@ -1374,7 +1374,7 @@ namespace System.Management.Automation if (keywords != null && keywords.Any()) { - string commandName = (completionContext.WordToComplete ?? String.Empty) + "*"; + string commandName = (completionContext.WordToComplete ?? string.Empty) + "*"; var wildcardPattern = WildcardPattern.Get(commandName, WildcardOptions.IgnoreCase | WildcardOptions.CultureInvariant); // Filter by name @@ -1550,7 +1550,7 @@ namespace System.Management.Automation string expandedString = null; var expandableStringAst = new ExpandableStringExpressionAst(strConst.Extent, strConst.Value, StringConstantType.BareWord); if (CompletionCompleters.IsPathSafelyExpandable(expandableStringAst: expandableStringAst, - extraText: String.Empty, + extraText: string.Empty, executionContext: completionContext.ExecutionContext, expandedString: out expandedString)) { @@ -1708,7 +1708,7 @@ namespace System.Management.Automation if (lastAst.Parent is FileRedirectionAst || CompleteAgainstSwitchFile(lastAst, completionContext.TokenBeforeCursor)) { string wordToComplete = - CompletionCompleters.ConcatenateStringPathArguments(lastAst as CommandElementAst, String.Empty, completionContext); + CompletionCompleters.ConcatenateStringPathArguments(lastAst as CommandElementAst, string.Empty, completionContext); if (wordToComplete != null) { needFileCompletion = true; @@ -1749,7 +1749,7 @@ namespace System.Management.Automation else { string wordToComplete = - CompletionCompleters.ConcatenateStringPathArguments(lastAst as CommandElementAst, String.Empty, completionContext); + CompletionCompleters.ConcatenateStringPathArguments(lastAst as CommandElementAst, string.Empty, completionContext); if (wordToComplete != null) { completionContext.WordToComplete = wordToComplete; diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index 58b492016..d6849f7aa 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -486,8 +486,8 @@ namespace System.Management.Automation // If parent is DynamicKeywordStatementAst - 'Import-DscResource', // then customize the auto completion results - if (keywordAst != null && String.Equals(keywordAst.Keyword.Keyword, "Import-DscResource", StringComparison.OrdinalIgnoreCase) - && !String.IsNullOrWhiteSpace(context.WordToComplete) && context.WordToComplete.StartsWith("-", StringComparison.OrdinalIgnoreCase)) + if (keywordAst != null && string.Equals(keywordAst.Keyword.Keyword, "Import-DscResource", StringComparison.OrdinalIgnoreCase) + && !string.IsNullOrWhiteSpace(context.WordToComplete) && context.WordToComplete.StartsWith("-", StringComparison.OrdinalIgnoreCase)) { var lastAst = context.RelatedAsts.Last(); var wordToMatch = context.WordToComplete.Substring(1) + "*"; @@ -1324,7 +1324,7 @@ namespace System.Management.Automation var constantPathAst = stringAst as StringConstantExpressionAst; if (constantPathAst != null) { - string quote = String.Empty; + string quote = string.Empty; switch (constantPathAst.StringConstantType) { case StringConstantType.SingleQuoted: @@ -5974,7 +5974,7 @@ namespace System.Management.Automation var typeAsts = scriptBlockAst.FindAll(ast => ast is TypeDefinitionAst, false).Cast(); foreach (var typeAst in typeAsts.Where(ast => pattern.IsMatch(ast.Name))) { - string toolTipPrefix = String.Empty; + string toolTipPrefix = string.Empty; if (typeAst.IsInterface) toolTipPrefix = "Interface "; else if (typeAst.IsClass) @@ -6004,7 +6004,7 @@ namespace System.Management.Automation && typeNameSpace != null && typeNameSpace.StartsWith(s.Name.Value, StringComparison.OrdinalIgnoreCase)); - string ns = String.Empty; + string ns = string.Empty; foreach (var nsState in matchingNsStates) { if (nsState.Name.Extent.Text.Length > ns.Length) @@ -6425,8 +6425,8 @@ namespace System.Management.Automation } } - var formattedString = String.Format(CultureInfo.InvariantCulture, expandableStringAst.FormatExpression, varValues.ToArray()); - string quote = (constType == StringConstantType.DoubleQuoted) ? "\"" : String.Empty; + var formattedString = string.Format(CultureInfo.InvariantCulture, expandableStringAst.FormatExpression, varValues.ToArray()); + string quote = (constType == StringConstantType.DoubleQuoted) ? "\"" : string.Empty; expandedString = quote + formattedString + extraText + quote; return true; @@ -6441,7 +6441,7 @@ namespace System.Management.Automation { // We check the strict mode inside GetVariableValue object value = VariableOps.GetVariableValue(varPath, executionContext, variableAst); - var strValue = (value == null) ? String.Empty : value as string; + var strValue = (value == null) ? string.Empty : value as string; if (strValue == null) { @@ -6792,7 +6792,7 @@ namespace System.Management.Automation if (string.IsNullOrEmpty(xPath) || string.IsNullOrEmpty(yPath)) Diagnostics.Assert(false, "Base object of item PSObject should be either PathInfo or FileSystemInfo"); - return String.Compare(xPath, yPath, StringComparison.CurrentCultureIgnoreCase); + return string.Compare(xPath, yPath, StringComparison.CurrentCultureIgnoreCase); } } @@ -6815,7 +6815,7 @@ namespace System.Management.Automation if (xName == null || yName == null) Diagnostics.Assert(false, "Base object of Command PSObject should be either CommandInfo or string"); - return String.Compare(xName, yName, StringComparison.OrdinalIgnoreCase); + return string.Compare(xName, yName, StringComparison.OrdinalIgnoreCase); } } diff --git a/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs b/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs index b8e77ffa5..897f40088 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs @@ -525,7 +525,7 @@ namespace System.Management.Automation.Language if (parameter.Type == typeof(SwitchParameter)) { if ((value != null) && - (String.Equals("$false", value.Extent.Text, StringComparison.OrdinalIgnoreCase))) + (string.Equals("$false", value.Extent.Text, StringComparison.OrdinalIgnoreCase))) { continue; } diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index e012c0f02..be30d8704 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -353,8 +353,8 @@ namespace System.Management.Automation ScriptRequiresException sre = new ScriptRequiresException( scriptInfo.Name, - String.Empty, - String.Empty, + string.Empty, + string.Empty, "RequiresShellIDInvalidForSingleShell"); throw sre; @@ -1349,7 +1349,7 @@ namespace System.Management.Automation bool isPathCacheValid = path != null && - String.Equals(_pathCacheKey, path, StringComparison.OrdinalIgnoreCase) && + string.Equals(_pathCacheKey, path, StringComparison.OrdinalIgnoreCase) && _cachedPath != null; if (!isPathCacheValid) @@ -1509,7 +1509,7 @@ namespace System.Management.Automation { if (!string.IsNullOrEmpty(commandName.PSSnapInName)) { - if (String.Equals(cmdletInfo.ModuleName, commandName.PSSnapInName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(cmdletInfo.ModuleName, commandName.PSSnapInName, StringComparison.OrdinalIgnoreCase)) { yield return cmdletInfo; if (!searchAllScopes) @@ -1523,7 +1523,7 @@ namespace System.Management.Automation // tries to access Microsoft.PowerShell.Core\\Get-Command, it cannot. So, adding an additional check to return the correct cmdletInfo for cmdlets from core modules. else if (InitialSessionState.IsEngineModule(cmdletInfo.ModuleName)) { - if (String.Equals( + if (string.Equals( cmdletInfo.ModuleName, InitialSessionState.GetNestedModuleDllName(commandName.PSSnapInName), StringComparison.OrdinalIgnoreCase)) @@ -1670,7 +1670,7 @@ namespace System.Management.Automation foreach (string name in this) { - if (String.Equals(item, name, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(item, name, StringComparison.OrdinalIgnoreCase)) { result = true; break; @@ -1727,7 +1727,7 @@ namespace System.Management.Automation for (int index = 0; index < this.Count; ++index) { - if (String.Equals(this[index], item, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(this[index], item, StringComparison.OrdinalIgnoreCase)) { result = index; break; diff --git a/src/System.Management.Automation/engine/CommandInfo.cs b/src/System.Management.Automation/engine/CommandInfo.cs index 1589e53d1..941cfca8f 100644 --- a/src/System.Management.Automation/engine/CommandInfo.cs +++ b/src/System.Management.Automation/engine/CommandInfo.cs @@ -178,7 +178,7 @@ namespace System.Management.Automation /// /// Gets the name of the command. /// - public string Name { get; private set; } = String.Empty; + public string Name { get; private set; } = string.Empty; // Name diff --git a/src/System.Management.Automation/engine/CommandMetadata.cs b/src/System.Management.Automation/engine/CommandMetadata.cs index 462b9420c..694a48082 100644 --- a/src/System.Management.Automation/engine/CommandMetadata.cs +++ b/src/System.Management.Automation/engine/CommandMetadata.cs @@ -448,7 +448,7 @@ namespace System.Management.Automation /// /// Gets the name of the command this metadata represents /// - public string Name { get; set; } = String.Empty; + public string Name { get; set; } = string.Empty; /// /// The Type which this CommandMetadata represents. @@ -507,7 +507,7 @@ namespace System.Management.Automation /// Related link URI for Get-Help -Online /// [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] - public string HelpUri { get; set; } = String.Empty; + public string HelpUri { get; set; } = string.Empty; /// /// The remoting capabilities of this cmdlet, when exposed in a context @@ -846,10 +846,10 @@ namespace System.Management.Automation _wrappedCommand, _wrappedCommandType); } - string dynamicParamblock = String.Empty; + string dynamicParamblock = string.Empty; if (generateDynamicParameters && this.ImplementsDynamicParameters) { - dynamicParamblock = String.Format(CultureInfo.InvariantCulture, @" + dynamicParamblock = string.Format(CultureInfo.InvariantCulture, @" dynamicparam {{{0}}} diff --git a/src/System.Management.Automation/engine/CommandProcessorBase.cs b/src/System.Management.Automation/engine/CommandProcessorBase.cs index 8f52b953f..e184722cf 100644 --- a/src/System.Management.Automation/engine/CommandProcessorBase.cs +++ b/src/System.Management.Automation/engine/CommandProcessorBase.cs @@ -410,10 +410,10 @@ namespace System.Management.Automation string commandName = string.IsNullOrEmpty(CommandInfo.Name) ? "script block" - : String.Format(System.Globalization.CultureInfo.InvariantCulture, + : string.Format(System.Globalization.CultureInfo.InvariantCulture, CommandBaseStrings.ObsoleteCommand, CommandInfo.Name); - string warningMsg = String.Format( + string warningMsg = string.Format( System.Globalization.CultureInfo.InvariantCulture, CommandBaseStrings.UseOfDeprecatedCommandWarning, commandName, obsoleteAttr.Message); diff --git a/src/System.Management.Automation/engine/CommandSearcher.cs b/src/System.Management.Automation/engine/CommandSearcher.cs index 083fb300d..8c41807d9 100644 --- a/src/System.Management.Automation/engine/CommandSearcher.cs +++ b/src/System.Management.Automation/engine/CommandSearcher.cs @@ -589,7 +589,7 @@ namespace System.Management.Automation break; } - if (String.Equals(extension, StringLiterals.PowerShellScriptFileExtension, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(extension, StringLiterals.PowerShellScriptFileExtension, StringComparison.OrdinalIgnoreCase)) { if ((_commandTypes & CommandTypes.ExternalScript) != 0) { diff --git a/src/System.Management.Automation/engine/CoreAdapter.cs b/src/System.Management.Automation/engine/CoreAdapter.cs index 2a074c096..b805a4083 100644 --- a/src/System.Management.Automation/engine/CoreAdapter.cs +++ b/src/System.Management.Automation/engine/CoreAdapter.cs @@ -3166,7 +3166,7 @@ namespace System.Management.Automation else { // A property/field declared with new in a derived class might appear twice - if (!String.Equals(previousMember.member.Name, fieldName)) + if (!string.Equals(previousMember.member.Name, fieldName)) { throw new ExtendedTypeSystemException("NotACLSComplaintField", null, ExtendedTypeSystem.NotAClsCompliantFieldProperty, fieldName, type.FullName, previousMember.member.Name); @@ -3187,7 +3187,7 @@ namespace System.Management.Automation else { var firstProperty = previousPropertyEntry[0]; - if (!String.Equals(property.Name, firstProperty.Name, StringComparison.Ordinal)) + if (!string.Equals(property.Name, firstProperty.Name, StringComparison.Ordinal)) { throw new ExtendedTypeSystemException("NotACLSComplaintProperty", null, ExtendedTypeSystem.NotAClsCompliantFieldProperty, property.Name, type.FullName, firstProperty.Name); diff --git a/src/System.Management.Automation/engine/DataStoreAdapter.cs b/src/System.Management.Automation/engine/DataStoreAdapter.cs index e50b05da7..74f69e5c4 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapter.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapter.cs @@ -354,7 +354,7 @@ namespace System.Management.Automation // Set the current working directory to the empty // string since it is relative to the root. - _currentWorkingDirectory = String.Empty; + _currentWorkingDirectory = string.Empty; Dbg.Diagnostics.Assert( _currentWorkingDirectory != null, @@ -605,7 +605,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("drive"); } - return String.Compare(Name, drive.Name, StringComparison.OrdinalIgnoreCase); + return string.Compare(Name, drive.Name, StringComparison.OrdinalIgnoreCase); #pragma warning restore 56506 } diff --git a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs index d50e699f4..eeafb2cc5 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs @@ -51,7 +51,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(this.PSSnapInName)) { result = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}\\{1}", this.PSSnapInName, @@ -62,7 +62,7 @@ namespace System.Management.Automation else if (!string.IsNullOrEmpty(this.ModuleName)) { result = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}\\{1}", this.ModuleName, @@ -124,7 +124,7 @@ namespace System.Management.Automation return PSSnapIn.Name; if (Module != null) return Module.Name; - return String.Empty; + return string.Empty; } } @@ -319,7 +319,7 @@ namespace System.Management.Automation string name, string helpFile, PSSnapInInfo psSnapIn) - : this(sessionState, implementingType, name, String.Empty, String.Empty, helpFile, psSnapIn) + : this(sessionState, implementingType, name, string.Empty, string.Empty, helpFile, psSnapIn) { } @@ -432,20 +432,20 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(qualifiedProviderName.PSSnapInName)) { // After converting core snapins to load as modules, the providers will have Module property populated - if (!String.Equals(qualifiedProviderName.PSSnapInName, this.PSSnapInName, StringComparison.OrdinalIgnoreCase) && - !String.Equals(qualifiedProviderName.PSSnapInName, this.ModuleName, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(qualifiedProviderName.PSSnapInName, this.PSSnapInName, StringComparison.OrdinalIgnoreCase) && + !string.Equals(qualifiedProviderName.PSSnapInName, this.ModuleName, StringComparison.OrdinalIgnoreCase)) { break; } } - result = String.Equals(qualifiedProviderName.ShortName, this.Name, StringComparison.OrdinalIgnoreCase); + result = string.Equals(qualifiedProviderName.ShortName, this.Name, StringComparison.OrdinalIgnoreCase); } while (false); } else { // If only the provider name is specified, then only the name must match - result = String.Equals(providerName, Name, StringComparison.OrdinalIgnoreCase); + result = string.Equals(providerName, Name, StringComparison.OrdinalIgnoreCase); } return result; @@ -477,7 +477,7 @@ namespace System.Management.Automation { if (namePattern == null) { - if (String.Equals(Name, psSnapinQualifiedName.ShortName, StringComparison.OrdinalIgnoreCase) && + if (string.Equals(Name, psSnapinQualifiedName.ShortName, StringComparison.OrdinalIgnoreCase) && IsPSSnapinNameMatch(psSnapinQualifiedName)) { result = true; @@ -497,7 +497,7 @@ namespace System.Management.Automation bool result = false; if (string.IsNullOrEmpty(psSnapinQualifiedName.PSSnapInName) || - String.Equals(psSnapinQualifiedName.PSSnapInName, PSSnapInName, StringComparison.OrdinalIgnoreCase)) + string.Equals(psSnapinQualifiedName.PSSnapInName, PSSnapInName, StringComparison.OrdinalIgnoreCase)) { result = true; } diff --git a/src/System.Management.Automation/engine/DscResourceInfo.cs b/src/System.Management.Automation/engine/DscResourceInfo.cs index 7f4efc7a6..761d6237a 100644 --- a/src/System.Management.Automation/engine/DscResourceInfo.cs +++ b/src/System.Management.Automation/engine/DscResourceInfo.cs @@ -116,7 +116,7 @@ namespace System.Management.Automation /// /// Gets the help file path for the cmdlet. /// - public string HelpFile { get; internal set; } = String.Empty; + public string HelpFile { get; internal set; } = string.Empty; // HelpFile } diff --git a/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs b/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs index bdbac44b2..0611f775e 100644 --- a/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs +++ b/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs @@ -34,7 +34,7 @@ namespace System.Management.Automation _underType = Enum.GetUnderlyingType(typeof(T)); - if (String.IsNullOrWhiteSpace(expression)) + if (string.IsNullOrWhiteSpace(expression)) { throw InterpreterError.NewInterpreterException(expression, typeof(RuntimeException), null, "EmptyInputString", EnumExpressionEvaluatorStrings.EmptyInputString); @@ -74,7 +74,7 @@ namespace System.Management.Automation foreach (string inputClause in expression) { - if (String.IsNullOrWhiteSpace(inputClause)) + if (string.IsNullOrWhiteSpace(inputClause)) { throw InterpreterError.NewInterpreterException(expression, typeof(RuntimeException), null, "EmptyInputString", EnumExpressionEvaluatorStrings.EmptyInputString); @@ -479,7 +479,7 @@ namespace System.Management.Automation result = result.Trim(); // possible empty token because white spaces are enclosed in quotation marks. - if (String.IsNullOrWhiteSpace(result)) + if (string.IsNullOrWhiteSpace(result)) { throw InterpreterError.NewInterpreterException(input, typeof(RuntimeException), null, "EmptyTokenString", EnumExpressionEvaluatorStrings.EmptyTokenString, diff --git a/src/System.Management.Automation/engine/ErrorPackage.cs b/src/System.Management.Automation/engine/ErrorPackage.cs index 097c4ae8b..1bffe27d2 100644 --- a/src/System.Management.Automation/engine/ErrorPackage.cs +++ b/src/System.Management.Automation/engine/ErrorPackage.cs @@ -372,7 +372,7 @@ namespace System.Management.Automation public string GetMessage() { /* Remoting not in E12 - if (!String.IsNullOrEmpty (_errorRecord._serializedErrorCategoryMessageOverride)) + if (!string.IsNullOrEmpty (_errorRecord._serializedErrorCategoryMessageOverride)) return _errorRecord._serializedErrorCategoryMessageOverride; */ @@ -431,7 +431,7 @@ namespace System.Management.Automation // assemble final string try { - return String.Format(uiCultureInfo, templateText, + return string.Format(uiCultureInfo, templateText, activityInUse, targetNameInUse, targetTypeInUse, @@ -442,7 +442,7 @@ namespace System.Management.Automation { templateText = ErrorCategoryStrings.InvalidErrorCategory; - return String.Format(uiCultureInfo, templateText, + return string.Format(uiCultureInfo, templateText, activityInUse, targetNameInUse, targetTypeInUse, @@ -915,7 +915,7 @@ namespace System.Management.Automation try { - return String.Format( + return string.Format( CultureInfo.CurrentCulture, template, args); @@ -1321,7 +1321,7 @@ namespace System.Management.Automation string errorDetails_ScriptStackTrace = GetNoteValue(serializedErrorRecord, "ErrorDetails_ScriptStackTrace") as string; - RemoteException re = new RemoteException((String.IsNullOrWhiteSpace(exceptionMessage) == false) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo); + RemoteException re = new RemoteException((string.IsNullOrWhiteSpace(exceptionMessage) == false) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo); //Create ErrorRecord PopulateProperties( diff --git a/src/System.Management.Automation/engine/EventManager.cs b/src/System.Management.Automation/engine/EventManager.cs index 9cd7a4ac2..e32abccb2 100644 --- a/src/System.Management.Automation/engine/EventManager.cs +++ b/src/System.Management.Automation/engine/EventManager.cs @@ -754,7 +754,7 @@ namespace System.Management.Automation if (PSEngineEvent.EngineEvents.Contains(sourceIdentifier)) { engineEventSourceIdentifier = sourceIdentifier; - isOnIdleEvent = String.Equals(engineEventSourceIdentifier, PSEngineEvent.OnIdle, StringComparison.OrdinalIgnoreCase); + isOnIdleEvent = string.Equals(engineEventSourceIdentifier, PSEngineEvent.OnIdle, StringComparison.OrdinalIgnoreCase); } } @@ -1319,7 +1319,7 @@ namespace System.Management.Automation foreach (PSEventSubscriber currentSubscriber in _eventSubscribers.Keys) { bool takeActionForEvent = false; - if (String.Equals(currentSubscriber.SourceIdentifier, sourceIdentifier, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(currentSubscriber.SourceIdentifier, sourceIdentifier, StringComparison.OrdinalIgnoreCase)) { if (forNewEventProcessing) { @@ -2057,7 +2057,7 @@ namespace System.Management.Automation return false; } - return (String.Equals(SubscriptionId, other.SubscriptionId)); + return (string.Equals(SubscriptionId, other.SubscriptionId)); } /// diff --git a/src/System.Management.Automation/engine/ExecutionContext.cs b/src/System.Management.Automation/engine/ExecutionContext.cs index 86b361f43..3cfcf7aed 100644 --- a/src/System.Management.Automation/engine/ExecutionContext.cs +++ b/src/System.Management.Automation/engine/ExecutionContext.cs @@ -1550,14 +1550,14 @@ namespace System.Management.Automation if (this.CurrentCommandProcessor != null) { CommandInfo cmdletInfo = this.CurrentCommandProcessor.CommandInfo; - if ((String.Equals(cmdletInfo.Name, "Import-Module", StringComparison.OrdinalIgnoreCase) || - String.Equals(cmdletInfo.Name, "Remove-Module", StringComparison.OrdinalIgnoreCase)) && + if ((string.Equals(cmdletInfo.Name, "Import-Module", StringComparison.OrdinalIgnoreCase) || + string.Equals(cmdletInfo.Name, "Remove-Module", StringComparison.OrdinalIgnoreCase)) && cmdletInfo.CommandType.Equals(CommandTypes.Cmdlet) && InitialSessionState.CoreModule.Equals(cmdletInfo.ModuleName, StringComparison.OrdinalIgnoreCase)) { result = true; command = (Cmdlet)this.CurrentCommandProcessor.Command; - errorId = String.Equals(cmdletInfo.Name, "Import-Module", StringComparison.OrdinalIgnoreCase) + errorId = string.Equals(cmdletInfo.Name, "Import-Module", StringComparison.OrdinalIgnoreCase) ? "Module_ImportModuleError" : "Module_RemoveModuleError"; } diff --git a/src/System.Management.Automation/engine/ExtendedTypeSystemException.cs b/src/System.Management.Automation/engine/ExtendedTypeSystemException.cs index 38906e73e..51a1de8a1 100644 --- a/src/System.Management.Automation/engine/ExtendedTypeSystemException.cs +++ b/src/System.Management.Automation/engine/ExtendedTypeSystemException.cs @@ -112,7 +112,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal MethodException(string errorId, Exception innerException, string resourceString, params object[] arguments) : @@ -177,7 +177,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal MethodInvocationException(string errorId, Exception innerException, string resourceString, params object[] arguments) : @@ -240,7 +240,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal GetValueException(string errorId, Exception innerException, string resourceString, params object[] arguments) : @@ -304,7 +304,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal PropertyNotFoundException(string errorId, Exception innerException, string resourceString, params object[] arguments) : @@ -367,7 +367,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal GetValueInvocationException(string errorId, Exception innerException, string resourceString, params object[] arguments) : @@ -428,7 +428,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal SetValueException(string errorId, Exception innerException, string resourceString, params object[] arguments) : @@ -489,7 +489,7 @@ namespace System.Management.Automation /// /// String that uniquely identifies each thrown Exception. /// The inner exception. - /// Resource String. + /// Resource string. /// Arguments to the resource string. internal SetValueInvocationException(string errorId, Exception innerException, string resourceString, params object[] arguments) : diff --git a/src/System.Management.Automation/engine/ExternalScriptInfo.cs b/src/System.Management.Automation/engine/ExternalScriptInfo.cs index 48c5502b5..f79aab694 100644 --- a/src/System.Management.Automation/engine/ExternalScriptInfo.cs +++ b/src/System.Management.Automation/engine/ExternalScriptInfo.cs @@ -139,7 +139,7 @@ namespace System.Management.Automation get { return _path; } } - private readonly string _path = String.Empty; + private readonly string _path = string.Empty; /// /// Gets the path to the script file. @@ -169,7 +169,7 @@ namespace System.Management.Automation foreach (CommandParameterSetInfo parameterSet in ParameterSets) { synopsis.AppendLine( - String.Format( + string.Format( Globalization.CultureInfo.CurrentCulture, "{0} {1}", Name, diff --git a/src/System.Management.Automation/engine/FunctionInfo.cs b/src/System.Management.Automation/engine/FunctionInfo.cs index cb3a4aa29..7f86f912e 100644 --- a/src/System.Management.Automation/engine/FunctionInfo.cs +++ b/src/System.Management.Automation/engine/FunctionInfo.cs @@ -407,7 +407,7 @@ namespace System.Management.Automation } } - private string _verb = String.Empty; + private string _verb = string.Empty; /// /// Gets the noun of the function. @@ -420,7 +420,7 @@ namespace System.Management.Automation } } - private string _noun = String.Empty; + private string _noun = string.Empty; /// /// Gets the help file path for the function. @@ -438,7 +438,7 @@ namespace System.Management.Automation } } - private string _helpFile = String.Empty; + private string _helpFile = string.Empty; /// /// Returns the syntax of a command @@ -453,7 +453,7 @@ namespace System.Management.Automation { synopsis.AppendLine(); synopsis.AppendLine( - String.Format( + string.Format( Globalization.CultureInfo.CurrentCulture, "{0} {1}", Name, diff --git a/src/System.Management.Automation/engine/GetCommandCommand.cs b/src/System.Management.Automation/engine/GetCommandCommand.cs index d970149ec..0639d50c3 100644 --- a/src/System.Management.Automation/engine/GetCommandCommand.cs +++ b/src/System.Management.Automation/engine/GetCommandCommand.cs @@ -382,7 +382,7 @@ namespace Microsoft.PowerShell.Commands // Throw out terminating error if this is the case. if (_isModuleSpecified && _isFullyQualifiedModuleSpecified) { - string errMsg = String.Format(CultureInfo.InvariantCulture, SessionStateStrings.GetContent_TailAndHeadCannotCoexist, "Module", "FullyQualifiedModule"); + string errMsg = string.Format(CultureInfo.InvariantCulture, SessionStateStrings.GetContent_TailAndHeadCannotCoexist, "Module", "FullyQualifiedModule"); ErrorRecord error = new ErrorRecord(new InvalidOperationException(errMsg), "ModuleAndFullyQualifiedModuleCannotBeSpecifiedTogether", ErrorCategory.InvalidOperation, null); ThrowTerminatingError(error); } @@ -575,7 +575,7 @@ namespace Microsoft.PowerShell.Commands } else { - return String.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase); + return string.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase); } } } @@ -1354,10 +1354,10 @@ namespace Microsoft.PowerShell.Commands foreach (CommandInfo commandInfo in _accumulatedResults) { if ((command.CommandType == commandInfo.CommandType && - (String.Compare(command.Name, commandInfo.Name, StringComparison.OrdinalIgnoreCase) == 0 || + (string.Compare(command.Name, commandInfo.Name, StringComparison.OrdinalIgnoreCase) == 0 || // If the command has been imported with a prefix, then just checking the names for duplication will not be enough. // Hence, an additional check is done with the prefix information - String.Compare(ModuleCmdletBase.RemovePrefixFromCommandName(commandInfo.Name, commandInfo.Prefix), command.Name, StringComparison.OrdinalIgnoreCase) == 0) + string.Compare(ModuleCmdletBase.RemovePrefixFromCommandName(commandInfo.Name, commandInfo.Prefix), command.Name, StringComparison.OrdinalIgnoreCase) == 0) ) && commandInfo.Module != null && commandHasModule && ( // We do reference equal comparison if both command are imported. If either one is not imported, we compare the module path (commandInfo.IsImported && command.IsImported && commandInfo.Module.Equals(command.Module)) || diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index d3b8f2a83..404949c2c 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -645,7 +645,7 @@ namespace System.Management.Automation.Runspaces /// /// A string describing this alias... /// - public string Description { get; } = String.Empty; + public string Description { get; } = string.Empty; /// /// Options controling scope visibility and setability for this entry. @@ -941,7 +941,7 @@ namespace System.Management.Automation.Runspaces /// /// The description associated with this variable. /// - public string Description { get; } = String.Empty; + public string Description { get; } = string.Empty; /// /// The options associated with this variable (e.g. readonly, allscope, etc.) @@ -1168,7 +1168,7 @@ namespace System.Management.Automation.Runspaces if (element == null) continue; if ((objType == null || element.GetType() == objType) && - String.Equals(element.Name, name, StringComparison.OrdinalIgnoreCase)) + string.Equals(element.Name, name, StringComparison.OrdinalIgnoreCase)) { _internalCollection.RemoveAt(i); } @@ -2664,7 +2664,7 @@ namespace System.Management.Automation.Runspaces break; case "ValidatePattern": - string pattern = "^(" + String.Join("|", parameterValidationValues) + ")$"; + string pattern = "^(" + string.Join("|", parameterValidationValues) + ")$"; ValidatePatternAttribute validatePattern = new ValidatePatternAttribute(pattern); metadata.Parameters[parameterName].Attributes.Add(validatePattern); break; @@ -4296,9 +4296,9 @@ end { // Bug fix for Win7:2202228 Engine halts if initial command fulls up variable table // Anytime a new variable that the engine depends on to run is added, this table // must be updated... - new SessionStateVariableEntry(SpecialVariables.LastToken, null, String.Empty), - new SessionStateVariableEntry(SpecialVariables.FirstToken, null, String.Empty), - new SessionStateVariableEntry(SpecialVariables.StackTrace, null, String.Empty), + new SessionStateVariableEntry(SpecialVariables.LastToken, null, string.Empty), + new SessionStateVariableEntry(SpecialVariables.FirstToken, null, string.Empty), + new SessionStateVariableEntry(SpecialVariables.StackTrace, null, string.Empty), // Variable which controls the encoding for piping data to a NativeCommand new SessionStateVariableEntry( @@ -4392,7 +4392,7 @@ end { //variable for PSEmailServer new SessionStateVariableEntry( SpecialVariables.PSEmailServer, - String.Empty, + string.Empty, RunspaceInit.PSEmailServerDescription ), @@ -4418,25 +4418,25 @@ end { new SessionStateVariableEntry( SpecialVariables.IsLinux, Platform.IsLinux, - String.Empty, + string.Empty, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope), new SessionStateVariableEntry( SpecialVariables.IsMacOS, Platform.IsMacOS, - String.Empty, + string.Empty, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope), new SessionStateVariableEntry( SpecialVariables.IsWindows, Platform.IsWindows, - String.Empty, + string.Empty, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope), new SessionStateVariableEntry( SpecialVariables.IsCoreCLR, Platform.IsCoreCLR, - String.Empty, + string.Empty, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope), #endregion }; diff --git a/src/System.Management.Automation/engine/InternalCommands.cs b/src/System.Management.Automation/engine/InternalCommands.cs index e0e86fadd..bfccde945 100644 --- a/src/System.Management.Automation/engine/InternalCommands.cs +++ b/src/System.Management.Automation/engine/InternalCommands.cs @@ -315,7 +315,7 @@ namespace Microsoft.PowerShell.Commands break; case "PropertyAndMethodSet": - _targetString = String.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectTarget, GetStringRepresentation(InputObject)); + _targetString = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectTarget, GetStringRepresentation(InputObject)); if (LanguagePrimitives.IsNull(InputObject)) { @@ -327,7 +327,7 @@ namespace Microsoft.PowerShell.Commands else { // should process - string propertyAction = String.Format(CultureInfo.InvariantCulture, + string propertyAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectPropertyAction, _propertyOrMethodName); if (ShouldProcess(_targetString, propertyAction)) @@ -409,7 +409,7 @@ namespace Microsoft.PowerShell.Commands if (targetParameterizedProperty != null) { // should process - string propertyAction = String.Format(CultureInfo.InvariantCulture, + string propertyAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectPropertyAction, targetParameterizedProperty.Name); // ParameterizedProperty always take parameters, so we output the member.Value directly @@ -426,7 +426,7 @@ namespace Microsoft.PowerShell.Commands try { // should process - string methodAction = String.Format(CultureInfo.InvariantCulture, + string methodAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectMethodActionWithoutArguments, targetMethod.Name); if (ShouldProcess(_targetString, methodAction)) @@ -495,7 +495,7 @@ namespace Microsoft.PowerShell.Commands if (!string.IsNullOrEmpty(resolvedPropertyName)) { // should process - string propertyAction = String.Format(CultureInfo.InvariantCulture, + string propertyAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectPropertyAction, resolvedPropertyName); if (ShouldProcess(_targetString, propertyAction)) @@ -568,7 +568,7 @@ namespace Microsoft.PowerShell.Commands if (errorRecord != null) { - string propertyAction = String.Format(CultureInfo.InvariantCulture, + string propertyAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectPropertyAction, _propertyOrMethodName); if (ShouldProcess(_targetString, propertyAction)) @@ -638,7 +638,7 @@ namespace Microsoft.PowerShell.Commands arglist.AppendFormat(CultureInfo.InvariantCulture, ", {0}", GetStringRepresentation(_arguments[i])); } - string methodAction = String.Format(CultureInfo.InvariantCulture, + string methodAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectMethodActionWithArguments, targetMethod.Name, arglist); @@ -706,7 +706,7 @@ namespace Microsoft.PowerShell.Commands { if (hash != null && hash.Contains(_propertyOrMethodName)) { - string keyAction = String.Format(CultureInfo.InvariantCulture, + string keyAction = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.ForEachObjectKeyAction, _propertyOrMethodName); if (ShouldProcess(_targetString, keyAction)) { @@ -1401,7 +1401,7 @@ namespace Microsoft.PowerShell.Commands { if (Context.LanguageMode.Equals(PSLanguageMode.RestrictedLanguage)) { - string message = String.Format(CultureInfo.InvariantCulture, + string message = string.Format(CultureInfo.InvariantCulture, InternalCommandStrings.OperationNotAllowedInRestrictedLanguageMode, _binaryOperator); PSInvalidOperationException exception = diff --git a/src/System.Management.Automation/engine/InvocationInfo.cs b/src/System.Management.Automation/engine/InvocationInfo.cs index bf36be98b..91548490d 100644 --- a/src/System.Management.Automation/engine/InvocationInfo.cs +++ b/src/System.Management.Automation/engine/InvocationInfo.cs @@ -291,7 +291,7 @@ namespace System.Management.Automation } else { - return String.Empty; + return string.Empty; } } } diff --git a/src/System.Management.Automation/engine/LanguagePrimitives.cs b/src/System.Management.Automation/engine/LanguagePrimitives.cs index 23555de63..52c8bd11d 100644 --- a/src/System.Management.Automation/engine/LanguagePrimitives.cs +++ b/src/System.Management.Automation/engine/LanguagePrimitives.cs @@ -623,7 +623,7 @@ namespace System.Management.Automation // If both first and second are null it returns true. // If one is null and the other is not it returns false. // if (first.Equals(second)) it returns true otherwise it goes ahead with type conversion operations. - // If both first and second are strings it returns (String.Compare(firstString, secondString, ignoreCase) == 0). + // If both first and second are strings it returns (string.Compare(firstString, secondString, ignoreCase) == 0). // If second can be converted to the type of the first, it does so and returns first.Equals(secondConverted) // Otherwise false is returned @@ -2207,7 +2207,7 @@ namespace System.Management.Automation } else { - if (String.Compare(sourceValueEntry, name, ignoreCaseOpt) != 0) + if (string.Compare(sourceValueEntry, name, ignoreCaseOpt) != 0) continue; } @@ -4115,7 +4115,7 @@ namespace System.Management.Automation { typeConversion.WriteLine("Converting null to \"\"."); // if the destination type is string, return an empty string... - return String.Empty; + return string.Empty; } private static PSReference ConvertNullToPSReference(object valueToConvert, diff --git a/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs b/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs index 33f8cddb7..f3272636f 100644 --- a/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs +++ b/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs @@ -297,7 +297,7 @@ namespace System.Management.Automation { var parameterSetName = keyValuePair.Key; var parameterSetData = keyValuePair.Value; - if (String.Equals(parameterSetName, ParameterAttribute.AllParameterSets, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(parameterSetName, ParameterAttribute.AllParameterSets, StringComparison.OrdinalIgnoreCase)) { // Don't add the parameter set name but assign the bit field zero and then mark the bool parameterSetData.ParameterSetFlag = 0; @@ -362,7 +362,7 @@ namespace System.Management.Automation } // Now check to see if there are any remaining sets passed this bit. - // If so return String.Empty + // If so return string.Empty if (((parameterSet >> (index + 1)) & 0x1) == 0) { @@ -373,12 +373,12 @@ namespace System.Management.Automation } else { - result = String.Empty; + result = string.Empty; } } else { - result = String.Empty; + result = string.Empty; } } @@ -407,7 +407,7 @@ namespace System.Management.Automation } } - return String.Empty; + return string.Empty; } /// @@ -463,7 +463,7 @@ namespace System.Management.Automation // If it is an exact match then only return the exact match // as the result - if (tryExactMatching && String.Equals(parameterName, name, StringComparison.OrdinalIgnoreCase)) + if (tryExactMatching && string.Equals(parameterName, name, StringComparison.OrdinalIgnoreCase)) { return _bindableParameters[parameterName]; } @@ -483,7 +483,7 @@ namespace System.Management.Automation // If it is an exact match then only return the exact match // as the result - if (tryExactMatching && String.Equals(parameterName, name, StringComparison.OrdinalIgnoreCase)) + if (tryExactMatching && string.Equals(parameterName, name, StringComparison.OrdinalIgnoreCase)) { return _aliasedParameters[parameterName]; } diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index ae01baf72..0ebff4ad1 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -310,7 +310,7 @@ namespace Microsoft.PowerShell.Commands foreach (string folder in Directory.EnumerateDirectories(path)) { string moduleName = Path.GetFileName(folder); - if (String.Compare(moduleName, fileBaseName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(moduleName, fileBaseName, StringComparison.OrdinalIgnoreCase) == 0) { fileBaseName = moduleName; #endif @@ -405,7 +405,7 @@ namespace Microsoft.PowerShell.Commands if (!isValidModuleVersion) { - WriteVerbose(String.Format(CultureInfo.InvariantCulture, Modules.SkippingInvalidModuleVersionFolder, + WriteVerbose(string.Format(CultureInfo.InvariantCulture, Modules.SkippingInvalidModuleVersionFolder, version.ToString(), moduleBase)); } } @@ -988,7 +988,7 @@ namespace Microsoft.PowerShell.Commands PSModuleInfo module = CreateModuleInfoForGetModule(file, refresh); if (module != null) { - if (String.Equals(moduleName, module.Name, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(moduleName, module.Name, StringComparison.OrdinalIgnoreCase)) { foundModule = true; // We need to list all versions of the module. @@ -1204,7 +1204,7 @@ namespace Microsoft.PowerShell.Commands ImportModuleOptions options = new ImportModuleOptions(); bool found = false; - moduleInfo = LoadModule(file, moduleBase: null, prefix: String.Empty, ss: null, ref options, flags, out found); + moduleInfo = LoadModule(file, moduleBase: null, prefix: string.Empty, ss: null, ref options, flags, out found); } // return fake PSModuleInfo if can't read the file for any reason @@ -2148,7 +2148,7 @@ namespace Microsoft.PowerShell.Commands { if (writingErrors) { - string invalidNameStr = String.Join(", ", invalidNames); + string invalidNameStr = string.Join(", ", invalidNames); string errorMsg = StringUtil.Format(Modules.InvalidExperimentalFeatureName, invalidNameStr); WriteError(new ErrorRecord(new ArgumentException(errorMsg), "Modules_InvalidExperimentalFeatureName", @@ -2457,7 +2457,7 @@ namespace Microsoft.PowerShell.Commands Modules.PSEditionNotSupported, moduleManifestPath, PSVersionInfo.PSEdition, - String.Join(',', inferredCompatiblePSEditions)); + string.Join(',', inferredCompatiblePSEditions)); InvalidOperationException ioe = new InvalidOperationException(message); diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 59bba0e2f..277a6f328 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -276,7 +276,7 @@ namespace System.Management.Automation internal List GetExactMatchModules(string moduleName, bool all, bool exactMatch) { - if (moduleName == null) { moduleName = String.Empty; } + if (moduleName == null) { moduleName = string.Empty; } return GetModuleCore(new string[] { moduleName }, all, exactMatch); } diff --git a/src/System.Management.Automation/engine/Modules/ModuleSpecification.cs b/src/System.Management.Automation/engine/Modules/ModuleSpecification.cs index 1db899ba2..f89a3b09d 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleSpecification.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleSpecification.cs @@ -321,11 +321,11 @@ namespace Microsoft.PowerShell.Commands } return x != null && y != null - && String.Equals(x.Name, y.Name, StringComparison.OrdinalIgnoreCase) + && string.Equals(x.Name, y.Name, StringComparison.OrdinalIgnoreCase) && Guid.Equals(x.Guid, y.Guid) && Version.Equals(x.RequiredVersion, y.RequiredVersion) && Version.Equals(x.Version, y.Version) - && String.Equals(x.MaximumVersion, y.MaximumVersion); + && string.Equals(x.MaximumVersion, y.MaximumVersion); } /// diff --git a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs index 96858c276..550598733 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs @@ -145,7 +145,7 @@ namespace System.Management.Automation.Internal { analysisProgress = new ProgressRecord(0, Modules.DeterminingAvailableModules, - String.Format(CultureInfo.InvariantCulture, Modules.SearchingUncShare, directory)) + string.Format(CultureInfo.InvariantCulture, Modules.SearchingUncShare, directory)) { RecordType = ProgressRecordType.Processing }; @@ -507,7 +507,7 @@ namespace System.Management.Automation.Internal moduleCompareName = commandEntry.PSSnapIn.Name; } - if (String.Equals(moduleShortName, moduleCompareName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(moduleShortName, moduleCompareName, StringComparison.OrdinalIgnoreCase)) { if (commandEntry.Visibility == SessionStateEntryVisibility.Private) { diff --git a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs index 8684969de..31f9aa5aa 100644 --- a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs @@ -914,7 +914,7 @@ namespace Microsoft.PowerShell.Commands insert = " " + insert; } - return String.Format(CultureInfo.InvariantCulture, "#{0}{1}", insert, streamWriter.NewLine); + return string.Format(CultureInfo.InvariantCulture, "#{0}{1}", insert, streamWriter.NewLine); } /// @@ -976,7 +976,7 @@ namespace Microsoft.PowerShell.Commands if (CompatiblePSEditions != null && (CompatiblePSEditions.Distinct(StringComparer.OrdinalIgnoreCase).Count() != CompatiblePSEditions.Count())) { - string message = StringUtil.Format(Modules.DuplicateEntriesInCompatiblePSEditions, String.Join(",", CompatiblePSEditions)); + string message = StringUtil.Format(Modules.DuplicateEntriesInCompatiblePSEditions, string.Join(",", CompatiblePSEditions)); var ioe = new InvalidOperationException(message); var er = new ErrorRecord(ioe, "Modules_DuplicateEntriesInCompatiblePSEditions", ErrorCategory.InvalidArgument, CompatiblePSEditions); ThrowTerminatingError(er); @@ -1041,7 +1041,7 @@ namespace Microsoft.PowerShell.Commands result.Append(streamWriter.NewLine); if (_rootModule == null) - _rootModule = String.Empty; + _rootModule = string.Empty; BuildModuleManifest(result, "RootModule", Modules.RootModule, !string.IsNullOrEmpty(_rootModule), () => QuoteName(_rootModule), streamWriter); @@ -1223,7 +1223,7 @@ namespace Microsoft.PowerShell.Commands private void ValidateUriParameterValue(Uri uri, string parameterName) { - Dbg.Assert(!String.IsNullOrWhiteSpace(parameterName), "parameterName should not be null or whitespace"); + Dbg.Assert(!string.IsNullOrWhiteSpace(parameterName), "parameterName should not be null or whitespace"); if (uri != null && !Uri.IsWellFormedUriString(uri.AbsoluteUri, UriKind.Absolute)) { diff --git a/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs b/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs index dd3fcfa37..31dde4bb1 100644 --- a/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs +++ b/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs @@ -218,7 +218,7 @@ namespace System.Management.Automation /// /// The name of this module. /// - public string Name { get; private set; } = String.Empty; + public string Name { get; private set; } = string.Empty; /// /// Sets the name property of the PSModuleInfo object @@ -232,7 +232,7 @@ namespace System.Management.Automation /// /// The path to the file that defined this module... /// - public string Path { get; internal set; } = String.Empty; + public string Path { get; internal set; } = string.Empty; /// /// If the module is a binary module or a script module that defines @@ -247,7 +247,7 @@ namespace System.Management.Automation /// public string Definition { - get { return _definitionExtent == null ? String.Empty : _definitionExtent.Text; } + get { return _definitionExtent == null ? string.Empty : _definitionExtent.Text; } } internal IScriptExtent _definitionExtent; @@ -259,10 +259,10 @@ namespace System.Management.Automation { get { return _description; } - set { _description = value ?? String.Empty; } + set { _description = value ?? string.Empty; } } - private string _description = String.Empty; + private string _description = string.Empty; /// /// The guid for this module if one was defined in the module manifest. diff --git a/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs b/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs index 73c8a7898..4f9122e34 100644 --- a/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs +++ b/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs @@ -27,7 +27,7 @@ namespace System.Management.Automation { ProgressRecord analysisProgress = new ProgressRecord(0, Modules.ScriptAnalysisPreparing, - String.Format(CultureInfo.InvariantCulture, Modules.ScriptAnalysisModule, path)); + string.Format(CultureInfo.InvariantCulture, Modules.ScriptAnalysisModule, path)); analysisProgress.RecordType = ProgressRecordType.Processing; // Write the progress using a static source ID so that all @@ -228,7 +228,7 @@ namespace System.Management.Automation public override AstVisitAction VisitAssignmentStatement(AssignmentStatementAst assignmentStatementAst) { // $env:PATH += "";$psScriptRoot"" - if (String.Equals("$env:PATH", assignmentStatementAst.Left.ToString(), StringComparison.OrdinalIgnoreCase) && + if (string.Equals("$env:PATH", assignmentStatementAst.Left.ToString(), StringComparison.OrdinalIgnoreCase) && Regex.IsMatch(assignmentStatementAst.Right.ToString(), "\\$psScriptRoot", RegexOptions.IgnoreCase)) { ModuleIntrinsics.Tracer.WriteLine("Module adds itself to the path."); @@ -286,12 +286,12 @@ namespace System.Management.Automation } // They are setting an alias. - if (String.Equals(commandName, "New-Alias", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "Microsoft.PowerShell.Utility\\New-Alias", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "Set-Alias", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "Microsoft.PowerShell.Utility\\Set-Alias", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "nal", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "sal", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(commandName, "New-Alias", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "Microsoft.PowerShell.Utility\\New-Alias", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "Set-Alias", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "Microsoft.PowerShell.Utility\\Set-Alias", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "nal", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "sal", StringComparison.OrdinalIgnoreCase)) { // Set-Alias Foo-Bar5 Foo-Bar // Set-Alias -Name Foo-Bar6 -Value Foo-Bar @@ -317,8 +317,8 @@ namespace System.Management.Automation } // They are importing a module - if (String.Equals(commandName, "Import-Module", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "ipmo", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(commandName, "Import-Module", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "ipmo", StringComparison.OrdinalIgnoreCase)) { // Import-Module Module1 // Import-Module Module2 -Function Foo-Module2*, Foo-Module2Second* -Cmdlet Foo-Module2Cmdlet,Foo-Module2Cmdlet* @@ -361,9 +361,9 @@ namespace System.Management.Automation } // They are exporting a module member - if (String.Equals(commandName, "Export-ModuleMember", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "Microsoft.PowerShell.Core\\Export-ModuleMember", StringComparison.OrdinalIgnoreCase) || - String.Equals(commandName, "$script:ExportModuleMember", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(commandName, "Export-ModuleMember", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "Microsoft.PowerShell.Core\\Export-ModuleMember", StringComparison.OrdinalIgnoreCase) || + string.Equals(commandName, "$script:ExportModuleMember", StringComparison.OrdinalIgnoreCase)) { // Export-ModuleMember * // Export-ModuleMember Exported-UnNamedModuleMember @@ -409,7 +409,7 @@ namespace System.Management.Automation // They are exporting a module member using our advanced 'public' function // that we've presented in many demos - if ((String.Equals(commandName, "public", StringComparison.OrdinalIgnoreCase)) && + if ((string.Equals(commandName, "public", StringComparison.OrdinalIgnoreCase)) && (commandAst.CommandElements.Count > 2)) { // public function Publicly-ExportedFunction diff --git a/src/System.Management.Automation/engine/MshCommandRuntime.cs b/src/System.Management.Automation/engine/MshCommandRuntime.cs index 4a77fbb31..f46241f13 100644 --- a/src/System.Management.Automation/engine/MshCommandRuntime.cs +++ b/src/System.Management.Automation/engine/MshCommandRuntime.cs @@ -870,7 +870,7 @@ namespace System.Management.Automation if (cmdletInfo != null) { - if (String.Equals("Add-Type", cmdletInfo.Name, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("Add-Type", cmdletInfo.Name, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -919,7 +919,7 @@ namespace System.Management.Automation if ( (!string.IsNullOrEmpty(this.OutVariable)) && (!(this.OutVariable.StartsWith("+", StringComparison.Ordinal))) && - String.Equals("Out-Default", _thisCommand.CommandInfo.Name, StringComparison.OrdinalIgnoreCase)) + string.Equals("Out-Default", _thisCommand.CommandInfo.Name, StringComparison.OrdinalIgnoreCase)) { if (_state == null) _state = new SessionState(Context.EngineSessionState); @@ -1252,8 +1252,8 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}?", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}?", filename), /// "Delete file")) /// { /// // delete the object @@ -1368,8 +1368,8 @@ namespace System.Management.Automation /// { /// ShouldProcessReason shouldProcessReason; /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}?", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}?", filename), /// "Delete file", /// out shouldProcessReason)) /// { @@ -1681,14 +1681,14 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}", filename), /// "Delete file")) /// { /// if (IsReadOnly(filename)) /// { /// if (!Force && !ShouldContinue( - /// String.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), + /// string.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), /// "Delete file")) /// ) /// { @@ -1861,14 +1861,14 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}", filename), /// "Delete file")) /// { /// if (IsReadOnly(filename)) /// { /// if (!Force && !ShouldContinue( - /// String.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), + /// string.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), /// "Delete file"), /// ref yesToAll, /// ref noToAll diff --git a/src/System.Management.Automation/engine/MshObjectTypeDescriptor.cs b/src/System.Management.Automation/engine/MshObjectTypeDescriptor.cs index fc7f76b92..687cac7b7 100644 --- a/src/System.Management.Automation/engine/MshObjectTypeDescriptor.cs +++ b/src/System.Management.Automation/engine/MshObjectTypeDescriptor.cs @@ -538,7 +538,7 @@ namespace System.Management.Automation // returning in GetProperties foreach (PropertyDescriptor descriptor in properties) { - if (String.Equals(descriptor.Name, defaultProperty, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(descriptor.Name, defaultProperty, StringComparison.OrdinalIgnoreCase)) { return descriptor; } diff --git a/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs b/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs index b515e1b40..5e7e0d240 100644 --- a/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs +++ b/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs @@ -41,7 +41,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(_psSnapinName)) { _fullName = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}\\{1}", _psSnapinName, diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index e92966466..d0152e7cd 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -1161,7 +1161,7 @@ namespace System.Management.Automation // We have the test 'utscript\Engine\TestOutDefaultRedirection.ps1' to check that a user defined // Out-Default function should not cause a native command to be redirected. So here we should only // compare the command name to avoid breaking change. - if (String.Equals(outputProcessor.CommandInfo.Name, "Out-Default", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(outputProcessor.CommandInfo.Name, "Out-Default", StringComparison.OrdinalIgnoreCase)) { // Verify that this isn't an Out-Default added for transcribing if (!outputProcessor.Command.MyInvocation.BoundParameters.ContainsKey("Transcript")) diff --git a/src/System.Management.Automation/engine/ObjectEventRegistrationBase.cs b/src/System.Management.Automation/engine/ObjectEventRegistrationBase.cs index 6c624c119..555ecb80b 100644 --- a/src/System.Management.Automation/engine/ObjectEventRegistrationBase.cs +++ b/src/System.Management.Automation/engine/ObjectEventRegistrationBase.cs @@ -186,7 +186,7 @@ namespace Microsoft.PowerShell.Commands // Detect if the event identifier already exists ErrorRecord errorRecord = new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, EventingResources.SubscriberExists, _sourceIdentifier)), "SUBSCRIBER_EXISTS", diff --git a/src/System.Management.Automation/engine/PSClassInfo.cs b/src/System.Management.Automation/engine/PSClassInfo.cs index c2fe50133..6da01a458 100644 --- a/src/System.Management.Automation/engine/PSClassInfo.cs +++ b/src/System.Management.Automation/engine/PSClassInfo.cs @@ -48,7 +48,7 @@ namespace System.Management.Automation /// /// Gets the help file path for the cmdlet. /// - public string HelpFile { get; internal set; } = String.Empty; + public string HelpFile { get; internal set; } = string.Empty; } /// diff --git a/src/System.Management.Automation/engine/PSVersionInfo.cs b/src/System.Management.Automation/engine/PSVersionInfo.cs index d864f3205..7108f8941 100644 --- a/src/System.Management.Automation/engine/PSVersionInfo.cs +++ b/src/System.Management.Automation/engine/PSVersionInfo.cs @@ -264,7 +264,7 @@ namespace System.Management.Automation { get { - return String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", PSVersionInfo.PSVersion.Major, PSVersionInfo.PSVersion.Minor); + return string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", PSVersionInfo.PSVersion.Major, PSVersionInfo.PSVersion.Minor); } } @@ -375,7 +375,7 @@ namespace System.Management.Automation } else { - return String.Compare(xString, yString, StringComparison.OrdinalIgnoreCase); + return string.Compare(xString, yString, StringComparison.OrdinalIgnoreCase); } } } @@ -629,7 +629,7 @@ namespace System.Management.Automation public static SemanticVersion Parse(string version) { if (version == null) throw PSTraceSource.NewArgumentNullException(nameof(version)); - if (version == String.Empty) throw new FormatException(nameof(version)); + if (version == string.Empty) throw new FormatException(nameof(version)); var r = new VersionResult(); r.Init(true); @@ -970,7 +970,7 @@ namespace System.Management.Automation if (isNumber2) { return 1; } - int result = String.CompareOrdinal(ac, bc); + int result = string.CompareOrdinal(ac, bc); if (result != 0) { return result; } } } @@ -999,7 +999,7 @@ namespace System.Management.Automation internal void SetFailure(ParseFailureKind failure) { - SetFailure(failure, String.Empty); + SetFailure(failure, string.Empty); } internal void SetFailure(ParseFailureKind failure, string argument) diff --git a/src/System.Management.Automation/engine/ParameterBinderBase.cs b/src/System.Management.Automation/engine/ParameterBinderBase.cs index d4e7b6313..0d361ebfb 100644 --- a/src/System.Management.Automation/engine/ParameterBinderBase.cs +++ b/src/System.Management.Automation/engine/ParameterBinderBase.cs @@ -551,7 +551,7 @@ namespace System.Management.Automation (!isDefaultValue) && spb != null && !usesCmdletBinding) { - string obsoleteWarning = String.Format( + string obsoleteWarning = string.Format( CultureInfo.InvariantCulture, ParameterBinderStrings.UseOfDeprecatedParameterWarning, parameterMetadata.Name, @@ -1057,7 +1057,7 @@ namespace System.Management.Automation // If we have an PSObject with null base and we are trying to // convert to a string, then we need to use null instead of // calling LanguagePrimitives.ConvertTo as that will return - // String.Empty. + // string.Empty. if (toType == typeof(string) && argumentType == typeof(PSObject)) diff --git a/src/System.Management.Automation/engine/ParameterInfo.cs b/src/System.Management.Automation/engine/ParameterInfo.cs index ef4c12792..5100524e4 100644 --- a/src/System.Management.Automation/engine/ParameterInfo.cs +++ b/src/System.Management.Automation/engine/ParameterInfo.cs @@ -51,7 +51,7 @@ namespace System.Management.Automation /// /// Gets the name of the parameter. /// - public string Name { get; } = String.Empty; + public string Name { get; } = string.Empty; /// /// Gets the type of the parameter. @@ -99,7 +99,7 @@ namespace System.Management.Automation /// /// Gets the help message for this parameter. /// - public string HelpMessage { get; private set; } = String.Empty; + public string HelpMessage { get; private set; } = string.Empty; /// /// Gets the aliases by which this parameter can be referenced. diff --git a/src/System.Management.Automation/engine/ParameterSetInfo.cs b/src/System.Management.Automation/engine/ParameterSetInfo.cs index a1d09383a..01d4f31b2 100644 --- a/src/System.Management.Automation/engine/ParameterSetInfo.cs +++ b/src/System.Management.Automation/engine/ParameterSetInfo.cs @@ -47,7 +47,7 @@ namespace System.Management.Automation MergedCommandParameterMetadata parameterMetadata) { IsDefault = true; - Name = String.Empty; + Name = string.Empty; if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); diff --git a/src/System.Management.Automation/engine/ProgressRecord.cs b/src/System.Management.Automation/engine/ProgressRecord.cs index e88b6bcde..348009930 100644 --- a/src/System.Management.Automation/engine/ProgressRecord.cs +++ b/src/System.Management.Automation/engine/ProgressRecord.cs @@ -296,7 +296,7 @@ namespace System.Management.Automation ToString() { return - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, "parent = {0} id = {1} act = {2} stat = {3} cur = {4} pct = {5} sec = {6} type = {7}", parentId, diff --git a/src/System.Management.Automation/engine/PseudoParameters.cs b/src/System.Management.Automation/engine/PseudoParameters.cs index 61867f872..516d25ebe 100644 --- a/src/System.Management.Automation/engine/PseudoParameters.cs +++ b/src/System.Management.Automation/engine/PseudoParameters.cs @@ -94,7 +94,7 @@ namespace System.Management.Automation } } - private string _name = String.Empty; + private string _name = string.Empty; /// /// Gets or sets the type of the parameter. @@ -226,10 +226,10 @@ namespace System.Management.Automation { get { return _helpFile; } - set { _helpFile = string.IsNullOrEmpty(value) ? String.Empty : value; } + set { _helpFile = string.IsNullOrEmpty(value) ? string.Empty : value; } } - private string _helpFile = String.Empty; + private string _helpFile = string.Empty; /// /// Gets or sets private data associated with the runtime-defined parameters. diff --git a/src/System.Management.Automation/engine/ScopedItemSearcher.cs b/src/System.Management.Automation/engine/ScopedItemSearcher.cs index 25bf450c2..d42ce4169 100644 --- a/src/System.Management.Automation/engine/ScopedItemSearcher.cs +++ b/src/System.Management.Automation/engine/ScopedItemSearcher.cs @@ -436,7 +436,7 @@ namespace System.Management.Automation get { return _name; } } - private string _name = String.Empty; + private string _name = string.Empty; } /// diff --git a/src/System.Management.Automation/engine/ScriptCommandProcessor.cs b/src/System.Management.Automation/engine/ScriptCommandProcessor.cs index d46b3880d..be0e68d06 100644 --- a/src/System.Management.Automation/engine/ScriptCommandProcessor.cs +++ b/src/System.Management.Automation/engine/ScriptCommandProcessor.cs @@ -17,7 +17,7 @@ namespace System.Management.Automation internal abstract class ScriptCommandProcessorBase : CommandProcessorBase { protected ScriptCommandProcessorBase(ScriptBlock scriptBlock, ExecutionContext context, bool useLocalScope, CommandOrigin origin, SessionStateInternal sessionState) - : base(new ScriptInfo(String.Empty, scriptBlock, context)) + : base(new ScriptInfo(string.Empty, scriptBlock, context)) { this._dontUseScopeCommandOrigin = false; this._fromScriptFile = false; diff --git a/src/System.Management.Automation/engine/SessionState.cs b/src/System.Management.Automation/engine/SessionState.cs index 417b35ff1..daeb88a81 100644 --- a/src/System.Management.Automation/engine/SessionState.cs +++ b/src/System.Management.Automation/engine/SessionState.cs @@ -397,7 +397,7 @@ namespace System.Management.Automation if (list.Contains("*")) return SessionStateEntryVisibility.Public; foreach (string p in list) { - if (String.Equals(p, path, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(p, path, StringComparison.OrdinalIgnoreCase)) return SessionStateEntryVisibility.Public; if (WildcardPattern.ContainsWildcardCharacters(p)) diff --git a/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs b/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs index 9c20b957f..83fcd01da 100644 --- a/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs @@ -455,7 +455,7 @@ namespace System.Management.Automation // If the "private" scope was specified, make sure the options contain // the Private flag - if (String.Equals(scopeID, StringLiterals.Private, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(scopeID, StringLiterals.Private, StringComparison.OrdinalIgnoreCase)) { alias.Options |= ScopedItemOptions.Private; } diff --git a/src/System.Management.Automation/engine/SessionStateContainer.cs b/src/System.Management.Automation/engine/SessionStateContainer.cs index 8eeba942b..c705cee51 100644 --- a/src/System.Management.Automation/engine/SessionStateContainer.cs +++ b/src/System.Management.Automation/engine/SessionStateContainer.cs @@ -1337,7 +1337,7 @@ namespace System.Management.Automation isFileOrDirectoryPresent = dynParam.File.IsPresent || dynParam.Directory.IsPresent; } - if (String.Equals(childName, "*", StringComparison.OrdinalIgnoreCase) && isFileOrDirectoryPresent) + if (string.Equals(childName, "*", StringComparison.OrdinalIgnoreCase) && isFileOrDirectoryPresent) { string parentName = path.Substring(0, path.Length - childName.Length); path = parentName; @@ -1354,7 +1354,7 @@ namespace System.Management.Automation // those directories. if (!string.IsNullOrEmpty(path) && !IsItemContainer(path)) { - if (!String.Equals(childName, "*", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(childName, "*", StringComparison.OrdinalIgnoreCase)) { if (context.Include != null) { @@ -2385,7 +2385,7 @@ namespace System.Management.Automation DoGetChildNamesManually( providerInstance, providerPath, - String.Empty, + string.Empty, returnContainers, includeMatcher, excludeMatcher, @@ -2471,7 +2471,7 @@ namespace System.Management.Automation DoGetChildNamesManually( providerInstance, providerPath, - String.Empty, + string.Empty, returnContainers, includeMatcher, excludeMatcher, @@ -3475,7 +3475,7 @@ namespace System.Management.Automation // function can be abused if (context.ExecutionContext.HasRunspaceEverUsedConstrainedLanguageMode && (providerInstance is Microsoft.PowerShell.Commands.FunctionProvider) && - (String.Equals(type, "Directory", StringComparison.OrdinalIgnoreCase))) + (string.Equals(type, "Directory", StringComparison.OrdinalIgnoreCase))) { throw PSTraceSource.NewNotSupportedException(SessionStateStrings.DriveCmdletProvider_NotSupported); @@ -3520,7 +3520,7 @@ namespace System.Management.Automation out targetProvider, out targetProviderInstance); - if (String.Compare(targetProvider.Name, "filesystem", StringComparison.OrdinalIgnoreCase) != 0) + if (string.Compare(targetProvider.Name, "filesystem", StringComparison.OrdinalIgnoreCase) != 0) { throw PSTraceSource.NewNotSupportedException(SessionStateStrings.MustBeFileSystemPath); } @@ -4097,7 +4097,7 @@ namespace System.Management.Automation if (copyPath == null) { - copyPath = String.Empty; + copyPath = string.Empty; } CmdletProviderContext context = new CmdletProviderContext(this.ExecutionContext); @@ -4163,7 +4163,7 @@ namespace System.Management.Automation if (copyPath == null) { - copyPath = String.Empty; + copyPath = string.Empty; } // Get the provider specific path for the destination @@ -4195,7 +4195,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new ArgumentException( - String.Format(System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemFromSessionToSession, "FromSession", "ToSession")), + string.Format(System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemFromSessionToSession, "FromSession", "ToSession")), "InvalidInput", ErrorCategory.InvalidArgument, dynamicParams)); @@ -4229,7 +4229,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new ArgumentNullException( - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemRemotelyPathIsNullOrEmpty, "Destination")), @@ -4805,7 +4805,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new InvalidOperationException( - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemSessionProperties, "LanguageMode", @@ -4844,7 +4844,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new InvalidOperationException( - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemValidateRemotePath, path)), "FailedToValidateRemotePath", ErrorCategory.InvalidOperation, @@ -4860,7 +4860,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemRemotelyPathIsNotAbsolute, path)), "RemotePathIsNotAbsolute", ErrorCategory.InvalidArgument, @@ -4889,7 +4889,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new ArgumentException( - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.PathNotFound, path)), "RemotePathNotFound", ErrorCategory.InvalidArgument, @@ -4907,7 +4907,7 @@ namespace System.Management.Automation { context.WriteError(new ErrorRecord( new InvalidOperationException( - String.Format(System.Globalization.CultureInfo.InvariantCulture, + string.Format(System.Globalization.CultureInfo.InvariantCulture, SessionStateStrings.CopyItemSessionProperties, "Availability", session.Availability)), "SessionIsNotAvailable", diff --git a/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs b/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs index e744bc031..5ea04e490 100644 --- a/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs @@ -169,7 +169,7 @@ namespace System.Management.Automation return; } - if (String.Compare(result.Name, drive.Name, StringComparison.CurrentCultureIgnoreCase) == 0) + if (string.Compare(result.Name, drive.Name, StringComparison.CurrentCultureIgnoreCase) == 0) { // Set the drive in the current scope. @@ -660,7 +660,7 @@ namespace System.Management.Automation { // Create a new drive string systemDriveName = systemDriveInfo.Name.Substring(0, 1); - string volumeLabel = String.Empty; + string volumeLabel = string.Empty; string displayRoot = null; try @@ -776,13 +776,13 @@ namespace System.Management.Automation // mount the default drive, since the provider names can be used for provider-qualified paths. // The WSMAN drive is the same as the provider name. if ( - String.Equals("Cert", name, StringComparison.OrdinalIgnoreCase) || - String.Equals("Certificate", name, StringComparison.OrdinalIgnoreCase) + string.Equals("Cert", name, StringComparison.OrdinalIgnoreCase) || + string.Equals("Certificate", name, StringComparison.OrdinalIgnoreCase) ) { moduleName = "Microsoft.PowerShell.Security"; } - else if (String.Equals("WSMan", name, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals("WSMan", name, StringComparison.OrdinalIgnoreCase)) { moduleName = "Microsoft.WSMan.Management"; } @@ -1294,7 +1294,7 @@ namespace System.Management.Automation // Make sure the provider didn't try to pull a fast one on us // and substitute a different drive. - if (String.Compare(result.Name, drive.Name, StringComparison.CurrentCultureIgnoreCase) == 0) + if (string.Compare(result.Name, drive.Name, StringComparison.CurrentCultureIgnoreCase) == 0) { driveRemovable = true; } diff --git a/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs b/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs index cfc2fcd50..6cffc5444 100644 --- a/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs @@ -733,7 +733,7 @@ namespace System.Management.Automation providerSpecificPath, currentWorkingPath); - if (String.Compare(providerSpecificPath, currentWorkingPath, StringComparison.CurrentCultureIgnoreCase) == 0) + if (string.Compare(providerSpecificPath, currentWorkingPath, StringComparison.CurrentCultureIgnoreCase) == 0) { // The path is the current working directory so // return true @@ -757,7 +757,7 @@ namespace System.Management.Automation GetParentPath( drive.Provider, lockedDirectory, - String.Empty, + string.Empty, context); s_tracer.WriteLine( @@ -765,7 +765,7 @@ namespace System.Management.Automation lockedDirectory, providerSpecificPath); - if (String.Compare(lockedDirectory, providerSpecificPath, StringComparison.CurrentCultureIgnoreCase) == 0) + if (string.Compare(lockedDirectory, providerSpecificPath, StringComparison.CurrentCultureIgnoreCase) == 0) { // The path is a parent of the current working // directory @@ -958,7 +958,7 @@ namespace System.Management.Automation result = SetLocation(newPath); if (locationStack.Count == 0 && - !String.Equals(stackName, startingDefaultStackName, StringComparison.OrdinalIgnoreCase)) + !string.Equals(stackName, startingDefaultStackName, StringComparison.OrdinalIgnoreCase)) { // Remove the stack from the stack list if it // no longer contains any paths. @@ -1003,7 +1003,7 @@ namespace System.Management.Automation { // If the request was for the default stack, but it doesn't // yet exist, create a dummy stack and return it. - if (String.Equals( + if (string.Equals( stackName, startingDefaultStackName, StringComparison.OrdinalIgnoreCase)) @@ -1043,7 +1043,7 @@ namespace System.Management.Automation if (!_workingLocationStack.ContainsKey(stackName)) { - if (String.Equals(stackName, startingDefaultStackName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(stackName, startingDefaultStackName, StringComparison.OrdinalIgnoreCase)) { // Since the "default" stack must always exist, create it here return new PathInfoStack(startingDefaultStackName, new Stack()); diff --git a/src/System.Management.Automation/engine/SessionStateNavigation.cs b/src/System.Management.Automation/engine/SessionStateNavigation.cs index 1c7f27f90..b480166e2 100644 --- a/src/System.Management.Automation/engine/SessionStateNavigation.cs +++ b/src/System.Management.Automation/engine/SessionStateNavigation.cs @@ -1488,7 +1488,7 @@ namespace System.Management.Automation // Now verify the providers are the same. - if (!String.Equals( + if (!string.Equals( provider.FullName, destinationProvider.FullName, StringComparison.OrdinalIgnoreCase)) diff --git a/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs b/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs index bc43aabef..a1119a61b 100644 --- a/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs @@ -887,11 +887,11 @@ namespace System.Management.Automation foreach (ProviderInfo provider in matchingProviders) { - if (String.Equals( + if (string.Equals( provider.PSSnapInName, providerName.PSSnapInName, StringComparison.OrdinalIgnoreCase) || - String.Equals( + string.Equals( provider.ModuleName, providerName.PSSnapInName, StringComparison.OrdinalIgnoreCase)) @@ -1031,7 +1031,7 @@ namespace System.Management.Automation "InitializeDefaultDrivesException", SessionStateStrings.InitializeDefaultDrivesException, provider, - String.Empty, + string.Empty, e); context.WriteError( diff --git a/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs b/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs index ebb7b4555..d6b25eaa4 100644 --- a/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs @@ -52,28 +52,28 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(scopeID)) { - if (String.Equals( + if (string.Equals( scopeID, StringLiterals.Global, StringComparison.OrdinalIgnoreCase)) { result = GlobalScope; } - else if (String.Equals( + else if (string.Equals( scopeID, StringLiterals.Local, StringComparison.OrdinalIgnoreCase)) { result = _currentScope; } - else if (String.Equals( + else if (string.Equals( scopeID, StringLiterals.Private, StringComparison.OrdinalIgnoreCase)) { result = _currentScope; } - else if (String.Equals( + else if (string.Equals( scopeID, StringLiterals.Script, StringComparison.OrdinalIgnoreCase)) diff --git a/src/System.Management.Automation/engine/ShellVariable.cs b/src/System.Management.Automation/engine/ShellVariable.cs index 739258be3..549f973a0 100644 --- a/src/System.Management.Automation/engine/ShellVariable.cs +++ b/src/System.Management.Automation/engine/ShellVariable.cs @@ -202,7 +202,7 @@ namespace System.Management.Automation /// /// Gets the name of the variable. /// - public string Name { get; } = String.Empty; + public string Name { get; } = string.Empty; /// /// Gets or sets the description of the variable. @@ -220,7 +220,7 @@ namespace System.Management.Automation } } - private string _description = String.Empty; + private string _description = string.Empty; internal void DebuggerCheckVariableRead() { diff --git a/src/System.Management.Automation/engine/TypeMetadata.cs b/src/System.Management.Automation/engine/TypeMetadata.cs index 7e8a0faa4..6d835aaef 100644 --- a/src/System.Management.Automation/engine/TypeMetadata.cs +++ b/src/System.Management.Automation/engine/TypeMetadata.cs @@ -1230,7 +1230,7 @@ namespace System.Management.Automation /// /// Gets the type name of the bindable type /// - internal string TypeName { get; } = String.Empty; + internal string TypeName { get; } = string.Empty; /// /// Gets a dictionary of the compiled parameter metadata for this Type. diff --git a/src/System.Management.Automation/engine/TypeTable.cs b/src/System.Management.Automation/engine/TypeTable.cs index 80305e753..b4b34dfd9 100644 --- a/src/System.Management.Automation/engine/TypeTable.cs +++ b/src/System.Management.Automation/engine/TypeTable.cs @@ -1722,7 +1722,7 @@ namespace System.Management.Automation.Runspaces /// public TypeData(string typeName) : this() { - if (String.IsNullOrWhiteSpace(typeName)) + if (string.IsNullOrWhiteSpace(typeName)) throw PSTraceSource.NewArgumentNullException("typeName"); this.TypeName = typeName; } @@ -2141,7 +2141,7 @@ namespace System.Management.Automation.Runspaces /// internal TypeMemberData(string name) { - if (String.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) throw PSTraceSource.NewArgumentException("name"); Name = name; @@ -2720,7 +2720,7 @@ namespace System.Management.Automation.Runspaces for (int i = 0; i < members.Count; i++) { PSMemberInfo member = members[i]; - if (String.Compare(member.Name, noteName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(member.Name, noteName, StringComparison.OrdinalIgnoreCase) == 0) { noteAsMemberInfo = member; } @@ -2750,7 +2750,7 @@ namespace System.Management.Automation.Runspaces } else { - note.noteValue = String.Compare(sourceValueAsString, "false", StringComparison.OrdinalIgnoreCase) != 0; + note.noteValue = string.Compare(sourceValueAsString, "false", StringComparison.OrdinalIgnoreCase) != 0; } return true; @@ -2775,7 +2775,7 @@ namespace System.Management.Automation.Runspaces for (int i = 0; i < members.Count; i++) { PSMemberInfo member = members[i]; - if (String.Compare(member.Name, memberName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(member.Name, memberName, StringComparison.OrdinalIgnoreCase) == 0) { AddError(errors, typeName, TypesXmlStrings.MemberShouldNotBePresent, member.Name); return false; @@ -2791,7 +2791,7 @@ namespace System.Management.Automation.Runspaces for (int i = 0; i < members.Count; i++) { PSMemberInfo m = members[i]; - if (String.Compare(m.Name, noteName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(m.Name, noteName, StringComparison.OrdinalIgnoreCase) == 0) { member = m; } @@ -2837,7 +2837,7 @@ namespace System.Management.Automation.Runspaces string memberName = members[i].Name; for (int j = 0; j < s_standardMembers.Length; j++) { - if (String.Equals(memberName, s_standardMembers[j], StringComparison.OrdinalIgnoreCase)) + if (string.Equals(memberName, s_standardMembers[j], StringComparison.OrdinalIgnoreCase)) { found = true; break; diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 2a33e3c9f..5c69e62c9 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -953,8 +953,8 @@ namespace System.Management.Automation foreach (string deviceName in reservedDeviceNames) { if ( - String.Equals(deviceName, compareName, StringComparison.OrdinalIgnoreCase) || - String.Equals(deviceName, noExtensionCompareName, StringComparison.OrdinalIgnoreCase)) + string.Equals(deviceName, compareName, StringComparison.OrdinalIgnoreCase) || + string.Equals(deviceName, noExtensionCompareName, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -1055,7 +1055,7 @@ namespace System.Management.Automation internal static bool IsPowerShellAssembly(string assemblyName) { - if (!String.IsNullOrWhiteSpace(assemblyName)) + if (!string.IsNullOrWhiteSpace(assemblyName)) { // Remove the '.dll' if it's there... var fixedName = assemblyName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) @@ -1073,7 +1073,7 @@ namespace System.Management.Automation internal static string GetPowerShellAssemblyStrongName(string assemblyName) { - if (!String.IsNullOrWhiteSpace(assemblyName)) + if (!string.IsNullOrWhiteSpace(assemblyName)) { // Remove the '.dll' if it's there... string fixedName = assemblyName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) @@ -1155,7 +1155,7 @@ namespace System.Management.Automation if (bytesRead > 3) { - preamble = String.Join("-", initialBytes[0], initialBytes[1], initialBytes[2], initialBytes[3]); + preamble = string.Join("-", initialBytes[0], initialBytes[1], initialBytes[2], initialBytes[3]); if (encodingMap.TryGetValue(preamble, out foundEncoding)) { @@ -1166,7 +1166,7 @@ namespace System.Management.Automation // Test for three-byte preambles if (bytesRead > 2) { - preamble = String.Join("-", initialBytes[0], initialBytes[1], initialBytes[2]); + preamble = string.Join("-", initialBytes[0], initialBytes[1], initialBytes[2]); if (encodingMap.TryGetValue(preamble, out foundEncoding)) { return foundEncoding; @@ -1176,7 +1176,7 @@ namespace System.Management.Automation // Test for two-byte preambles if (bytesRead > 1) { - preamble = String.Join("-", initialBytes[0], initialBytes[1]); + preamble = string.Join("-", initialBytes[0], initialBytes[1]); if (encodingMap.TryGetValue(preamble, out foundEncoding)) { return foundEncoding; diff --git a/src/System.Management.Automation/engine/VariableInterfaces.cs b/src/System.Management.Automation/engine/VariableInterfaces.cs index 3e3a89dec..3308c080b 100644 --- a/src/System.Management.Automation/engine/VariableInterfaces.cs +++ b/src/System.Management.Automation/engine/VariableInterfaces.cs @@ -66,7 +66,7 @@ namespace System.Management.Automation // Parameter validation is done in the session state object - // Null is returned whenever the requested variable is String.Empty. + // Null is returned whenever the requested variable is string.Empty. // As per Powershell V1 implementation: // 1. If the requested variable exists in the session scope, the variable value is returned. // 2. If the requested variable is not null and does not exist in the session scope, then a null value is returned to the pipeline. diff --git a/src/System.Management.Automation/engine/cmdlet.cs b/src/System.Management.Automation/engine/cmdlet.cs index 21ef53280..db7c45a39 100644 --- a/src/System.Management.Automation/engine/cmdlet.cs +++ b/src/System.Management.Automation/engine/cmdlet.cs @@ -1018,8 +1018,8 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}?", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}?", filename), /// "Delete file")) /// { /// // delete the object @@ -1135,8 +1135,8 @@ namespace System.Management.Automation /// { /// ShouldProcessReason shouldProcessReason; /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}?", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}?", filename), /// "Delete file", /// out shouldProcessReason)) /// { @@ -1258,14 +1258,14 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}", filename), /// "Delete file")) /// { /// if (IsReadOnly(filename)) /// { /// if (!Force && !ShouldContinue( - /// String.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), + /// string.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), /// "Delete file")) /// ) /// { @@ -1390,14 +1390,14 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}", filename), /// "Delete file")) /// { /// if (IsReadOnly(filename)) /// { /// if (!Force && !ShouldContinue( - /// String.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), + /// string.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), /// "Delete file"), /// ref yesToAll, /// ref noToAll @@ -1530,14 +1530,14 @@ namespace System.Management.Automation /// public override void ProcessRecord() /// { /// if (ShouldProcess( - /// String.Format("Deleting file {0}",filename), - /// String.Format("Are you sure you want to delete file {0}", filename), + /// string.Format("Deleting file {0}",filename), + /// string.Format("Are you sure you want to delete file {0}", filename), /// "Delete file")) /// { /// if (IsReadOnly(filename)) /// { /// if (!Force && !ShouldContinue( - /// String.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), + /// string.Format("File {0} is read-only. Are you sure you want to delete read-only file {0}?", filename), /// "Delete file"), /// ref yesToAll, /// ref noToAll diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 8fae3806b..eb50cf0e3 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -1681,7 +1681,7 @@ namespace System.Management.Automation { _context.EngineHostInterface.UI.WriteWarningLine( breakpoints.Count > 0 - ? String.Format(CultureInfo.CurrentCulture, DebuggerStrings.WarningBreakpointWillNotBeHit, + ? string.Format(CultureInfo.CurrentCulture, DebuggerStrings.WarningBreakpointWillNotBeHit, breakpoints[0]) : new InvalidOperationException().Message); return; diff --git a/src/System.Management.Automation/engine/hostifaces/Command.cs b/src/System.Management.Automation/engine/hostifaces/Command.cs index 0c43c3cad..60ef6e684 100644 --- a/src/System.Management.Automation/engine/hostifaces/Command.cs +++ b/src/System.Management.Automation/engine/hostifaces/Command.cs @@ -835,7 +835,7 @@ namespace System.Management.Automation.Runspaces /// public void Add(string command) { - if (String.Equals(command, "out-default", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(command, "out-default", StringComparison.OrdinalIgnoreCase)) { this.Add(command, true); } diff --git a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs index 3637ca574..a8ecd94e1 100644 --- a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs +++ b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs @@ -605,7 +605,7 @@ namespace System.Management.Automation.Runspaces /// /// Create a pipeline from a command string /// - /// A valid command string or String.Empty. + /// A valid command string or string.Empty. /// If true command is added to history. /// True for nested pipeline. /// diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs index e7ed42a62..b533d14aa 100644 --- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs @@ -234,7 +234,7 @@ namespace System.Management.Automation { if (string.IsNullOrEmpty(source)) { - return String.Empty; + return string.Empty; } StringBuilder returnValue = new StringBuilder(); @@ -392,7 +392,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(suggestionText)) { - string returnString = String.Format( + string returnString = string.Format( CultureInfo.CurrentCulture, "Suggestion [{0},{1}]: {2}", (int)suggestion["Id"], @@ -405,7 +405,7 @@ namespace System.Management.Automation } else { - string matchText = String.Empty; + string matchText = string.Empty; // Otherwise, this is a Regex match against the // command or error @@ -444,7 +444,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(suggestionText)) { - string returnString = String.Format( + string returnString = string.Format( CultureInfo.CurrentCulture, "Suggestion [{0},{1}]: {2}", (int)suggestion["Id"], @@ -579,7 +579,7 @@ namespace System.Management.Automation catch (Exception) { // Catch-all OK. This is a third-party call-out. - return String.Empty; + return string.Empty; } return (string)LanguagePrimitives.ConvertTo(result, typeof(string), CultureInfo.CurrentCulture); @@ -621,17 +621,17 @@ namespace System.Management.Automation if (caption.Length > CREDUI_MAX_CAPTION_LENGTH) { - throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, CredUI.PromptForCredential_InvalidCaption, CREDUI_MAX_CAPTION_LENGTH)); + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, CredUI.PromptForCredential_InvalidCaption, CREDUI_MAX_CAPTION_LENGTH)); } if (message.Length > CREDUI_MAX_MESSAGE_LENGTH) { - throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, CredUI.PromptForCredential_InvalidMessage, CREDUI_MAX_MESSAGE_LENGTH)); + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, CredUI.PromptForCredential_InvalidMessage, CREDUI_MAX_MESSAGE_LENGTH)); } if (userName != null && userName.Length > CRED_MAX_USERNAME_LENGTH) { - throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, CredUI.PromptForCredential_InvalidUserName, CRED_MAX_USERNAME_LENGTH)); + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, CredUI.PromptForCredential_InvalidUserName, CRED_MAX_USERNAME_LENGTH)); } CREDUI_INFO credUiInfo = new CREDUI_INFO(); diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs index 36116c206..c80525e18 100644 --- a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs @@ -949,7 +949,7 @@ namespace System.Management.Automation.Internal.Host for (int i = 0; i < hotkeysAndPlainLabels.GetLength(1); ++i) { string choice = - String.Format( + string.Format( Globalization.CultureInfo.InvariantCulture, choiceTemplate, hotkeysAndPlainLabels[0, i], diff --git a/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs b/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs index 17c9d76cc..cbd386a05 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs @@ -1543,7 +1543,7 @@ namespace System.Management.Automation.Runspaces string moduleName, PSDataCollection errors) : base(StringUtil.Format(RunspaceStrings.ErrorLoadingModulesOnRunspaceOpen, moduleName, - (errors != null && errors.Count > 0 && errors[0] != null) ? errors[0].ToString() : String.Empty), null) + (errors != null && errors.Count > 0 && errors[0] != null) ? errors[0].ToString() : string.Empty), null) { _errors = errors; this.SetErrorId("ErrorLoadingModulesOnRunspaceOpen"); diff --git a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs index b03933dc9..6d91fc491 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs @@ -312,9 +312,9 @@ namespace System.Management.Automation.Runspaces // Don't need to add Out-Default if the pipeline already has it, or we've got a pipeline evaluating // the PSConsoleHostReadLine command. if ( - String.Equals(outDefaultCommandInfo.Name, command.CommandText, StringComparison.OrdinalIgnoreCase) || - String.Equals("PSConsoleHostReadLine", command.CommandText, StringComparison.OrdinalIgnoreCase) || - String.Equals("TabExpansion2", command.CommandText, StringComparison.OrdinalIgnoreCase) || + string.Equals(outDefaultCommandInfo.Name, command.CommandText, StringComparison.OrdinalIgnoreCase) || + string.Equals("PSConsoleHostReadLine", command.CommandText, StringComparison.OrdinalIgnoreCase) || + string.Equals("TabExpansion2", command.CommandText, StringComparison.OrdinalIgnoreCase) || this.IsPulsePipeline) { needToAddOutDefault = false; diff --git a/src/System.Management.Automation/engine/hostifaces/MshHostRawUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/MshHostRawUserInterface.cs index 357c302f3..7444a834b 100644 --- a/src/System.Management.Automation/engine/hostifaces/MshHostRawUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/MshHostRawUserInterface.cs @@ -73,7 +73,7 @@ namespace System.Management.Automation.Host string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0},{1}", X, Y); + return string.Format(CultureInfo.InvariantCulture, "{0},{1}", X, Y); } /// @@ -265,7 +265,7 @@ namespace System.Management.Automation.Host string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0},{1}", Width, Height); + return string.Format(CultureInfo.InvariantCulture, "{0},{1}", Width, Height); } /// @@ -842,7 +842,7 @@ namespace System.Management.Automation.Host string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0},{1} ; {2},{3}", Left, Top, Right, Bottom); + return string.Format(CultureInfo.InvariantCulture, "{0},{1} ; {2},{3}", Left, Top, Right, Bottom); } /// diff --git a/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs index 0f48ca157..4091d588d 100644 --- a/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs @@ -300,7 +300,7 @@ namespace System.Management.Automation.Host { transcript.OutputToLog.Add("**********************"); transcript.OutputToLog.Add( - String.Format( + string.Format( Globalization.CultureInfo.InvariantCulture, InternalHostUserInterfaceStrings.CommandStartTime, DateTime.Now.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture))); transcript.OutputToLog.Add("**********************"); @@ -350,7 +350,7 @@ namespace System.Management.Automation.Host string[] helperCommands = { "TabExpansion2", "prompt", "TabExpansion", "PSConsoleHostReadline" }; foreach (string helperCommand in helperCommands) { - if (String.Equals(helperCommand, commandName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(helperCommand, commandName, StringComparison.OrdinalIgnoreCase)) { IgnoreCommand(logElement, invocation); @@ -539,7 +539,7 @@ namespace System.Management.Automation.Host // Transcribe the transcript epilogue try { - string message = String.Format( + string message = string.Format( Globalization.CultureInfo.InvariantCulture, InternalHostUserInterfaceStrings.TranscriptEpilogue, DateTime.Now); @@ -606,7 +606,7 @@ namespace System.Management.Automation.Host if (TranscriptionData.CommandBeingIgnored != null) { // If we're ignoring a prompt, capture the value - if (String.Equals("prompt", TranscriptionData.CommandBeingIgnored, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("prompt", TranscriptionData.CommandBeingIgnored, StringComparison.OrdinalIgnoreCase)) { TranscriptionData.PromptText = resultText; } @@ -667,7 +667,7 @@ namespace System.Management.Automation.Host // If we're completing a command that we were ignoring, start transcribing results / etc. again. if ((TranscriptionData.CommandBeingIgnored != null) && (invocation != null) && (invocation.MyCommand != null) && - String.Equals(commandNameToCheck, invocation.MyCommand.Name, StringComparison.OrdinalIgnoreCase)) + string.Equals(commandNameToCheck, invocation.MyCommand.Name, StringComparison.OrdinalIgnoreCase)) { TranscriptionData.CommandBeingIgnored = null; TranscriptionData.IsHelperCommand = false; @@ -716,9 +716,9 @@ namespace System.Management.Automation.Host // Transcription should begin only if file generation is successful. // If there is an error in file generation, throw the exception. string baseDirectory = Path.GetDirectoryName(transcript.Path); - if (Directory.Exists(transcript.Path) || (String.Equals(baseDirectory, transcript.Path.TrimEnd(Path.DirectorySeparatorChar), StringComparison.Ordinal))) + if (Directory.Exists(transcript.Path) || (string.Equals(baseDirectory, transcript.Path.TrimEnd(Path.DirectorySeparatorChar), StringComparison.Ordinal))) { - string errorMessage = String.Format( + string errorMessage = string.Format( System.Globalization.CultureInfo.CurrentCulture, InternalHostUserInterfaceStrings.InvalidTranscriptFilePath, transcript.Path); @@ -1013,7 +1013,7 @@ namespace System.Management.Automation.Host // (5 bytes = 3 years, 4 bytes = about a month) byte[] randomBytes = new byte[6]; System.Security.Cryptography.RandomNumberGenerator.Create().GetBytes(randomBytes); - string filename = String.Format( + string filename = string.Format( Globalization.CultureInfo.InvariantCulture, "PowerShell_transcript.{0}.{1}.{2:yyyyMMddHHmmss}.txt", Environment.MachineName, @@ -1256,7 +1256,7 @@ namespace System.Management.Automation.Host if (string.Compare(hotkeysAndPlainLabels[0, i], "?", StringComparison.Ordinal) == 0) { Exception e = PSTraceSource.NewArgumentException( - String.Format(Globalization.CultureInfo.InvariantCulture, "choices[{0}].Label", i), + string.Format(Globalization.CultureInfo.InvariantCulture, "choices[{0}].Label", i), InternalHostUserInterfaceStrings.InvalidChoiceHotKeyError); throw e; } diff --git a/src/System.Management.Automation/engine/interpreter/BranchLabel.cs b/src/System.Management.Automation/engine/interpreter/BranchLabel.cs index 89b00785b..95313dc52 100644 --- a/src/System.Management.Automation/engine/interpreter/BranchLabel.cs +++ b/src/System.Management.Automation/engine/interpreter/BranchLabel.cs @@ -34,7 +34,7 @@ namespace System.Management.Automation.Interpreter public override string ToString() { - return String.Format(CultureInfo.InvariantCulture, "->{0} C({1}) S({2})", Index, ContinuationStackDepth, StackDepth); + return string.Format(CultureInfo.InvariantCulture, "->{0} C({1}) S({2})", Index, ContinuationStackDepth, StackDepth); } } diff --git a/src/System.Management.Automation/engine/interpreter/LabelInfo.cs b/src/System.Management.Automation/engine/interpreter/LabelInfo.cs index 8a1e07b3b..ea567ebb5 100644 --- a/src/System.Management.Automation/engine/interpreter/LabelInfo.cs +++ b/src/System.Management.Automation/engine/interpreter/LabelInfo.cs @@ -80,7 +80,7 @@ namespace System.Management.Automation.Interpreter { if (j.ContainsTarget(_node)) { - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Label target already defined: {0}", _node.Name)); + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Label target already defined: {0}", _node.Name)); } } @@ -132,7 +132,7 @@ namespace System.Management.Automation.Interpreter if (HasMultipleDefinitions) { - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Ambiguous jump {0}", _node.Name)); + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Ambiguous jump {0}", _node.Name)); } // We didn't find an outward jump. Look for a jump across blocks diff --git a/src/System.Management.Automation/engine/interpreter/LightCompiler.cs b/src/System.Management.Automation/engine/interpreter/LightCompiler.cs index 82bebc2da..27d55b22b 100644 --- a/src/System.Management.Automation/engine/interpreter/LightCompiler.cs +++ b/src/System.Management.Automation/engine/interpreter/LightCompiler.cs @@ -92,7 +92,7 @@ namespace System.Management.Automation.Interpreter public override string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0} [{1}-{2}] [{3}->{4}]", + return string.Format(CultureInfo.InvariantCulture, "{0} [{1}-{2}] [{3}->{4}]", (IsFault ? "fault" : "catch(" + ExceptionType.Name + ")"), StartIndex, EndIndex, HandlerStartIndex, HandlerEndIndex @@ -231,11 +231,11 @@ namespace System.Management.Automation.Interpreter { if (IsClear) { - return String.Format(CultureInfo.InvariantCulture, "{0}: clear", Index); + return string.Format(CultureInfo.InvariantCulture, "{0}: clear", Index); } else { - return String.Format(CultureInfo.InvariantCulture, "{0}: [{1}-{2}] '{3}'", Index, StartLine, EndLine, FileName); + return string.Format(CultureInfo.InvariantCulture, "{0}: [{1}-{2}] '{3}'", Index, StartLine, EndLine, FileName); } } } diff --git a/src/System.Management.Automation/engine/interpreter/LocalVariables.cs b/src/System.Management.Automation/engine/interpreter/LocalVariables.cs index 398566c13..3365e84c5 100644 --- a/src/System.Management.Automation/engine/interpreter/LocalVariables.cs +++ b/src/System.Management.Automation/engine/interpreter/LocalVariables.cs @@ -74,7 +74,7 @@ namespace System.Management.Automation.Interpreter public override string ToString() { - return String.Format(CultureInfo.InvariantCulture, "{0}: {1} {2}", Index, IsBoxed ? "boxed" : null, InClosure ? "in closure" : null); + return string.Format(CultureInfo.InvariantCulture, "{0}: {1} {2}", Index, IsBoxed ? "boxed" : null, InClosure ? "in closure" : null); } } diff --git a/src/System.Management.Automation/engine/interpreter/StackOperations.cs b/src/System.Management.Automation/engine/interpreter/StackOperations.cs index 6129fa633..51a5f0334 100644 --- a/src/System.Management.Automation/engine/interpreter/StackOperations.cs +++ b/src/System.Management.Automation/engine/interpreter/StackOperations.cs @@ -60,7 +60,7 @@ namespace System.Management.Automation.Interpreter public override string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - return String.Format(CultureInfo.InvariantCulture, "LoadCached({0}: {1})", _index, objects[(int)_index]); + return string.Format(CultureInfo.InvariantCulture, "LoadCached({0}: {1})", _index, objects[(int)_index]); } public override string ToString() diff --git a/src/System.Management.Automation/engine/lang/parserutils.cs b/src/System.Management.Automation/engine/lang/parserutils.cs index 887d4f075..e357a4bcd 100644 --- a/src/System.Management.Automation/engine/lang/parserutils.cs +++ b/src/System.Management.Automation/engine/lang/parserutils.cs @@ -956,7 +956,7 @@ namespace System.Management.Automation IEnumerator list = LanguagePrimitives.GetEnumerator(lval); if (list == null) { - string lvalString = lval?.ToString() ?? String.Empty; + string lvalString = lval?.ToString() ?? string.Empty; return ReplaceOperatorImpl(context, lvalString, rr, substitute); } @@ -1118,7 +1118,7 @@ namespace System.Management.Automation IEnumerator list = LanguagePrimitives.GetEnumerator(lval); if (list == null) { - string lvalString = lval == null ? String.Empty : PSObject.ToStringParser(context, lval); + string lvalString = lval == null ? string.Empty : PSObject.ToStringParser(context, lval); return BoolToObject(wcp.IsMatch(lvalString) ^ notLike); } @@ -1129,7 +1129,7 @@ namespace System.Management.Automation { object val = ParserOps.Current(errorPosition, list); - string lvalString = val == null ? String.Empty : PSObject.ToStringParser(context, val); + string lvalString = val == null ? string.Empty : PSObject.ToStringParser(context, val); if (wcp.IsMatch(lvalString) ^ notLike) { @@ -1167,7 +1167,7 @@ namespace System.Management.Automation IEnumerator list = LanguagePrimitives.GetEnumerator(lval); if (list == null) { - string lvalString = lval == null ? String.Empty : PSObject.ToStringParser(context, lval); + string lvalString = lval == null ? string.Empty : PSObject.ToStringParser(context, lval); // Find a match in the string. Match m = r.Match(lvalString); @@ -1210,7 +1210,7 @@ namespace System.Management.Automation { object val = list.Current; - string lvalString = val == null ? String.Empty : PSObject.ToStringParser(context, val); + string lvalString = val == null ? string.Empty : PSObject.ToStringParser(context, val); // Find a single match in the string. Match m = r.Match(lvalString); @@ -1443,7 +1443,7 @@ namespace System.Management.Automation { if (obj == null) { - return String.Empty; + return string.Empty; } PSObject mshObj = obj as PSObject; diff --git a/src/System.Management.Automation/engine/parser/Compiler.cs b/src/System.Management.Automation/engine/parser/Compiler.cs index 9f1471a91..aa7873145 100644 --- a/src/System.Management.Automation/engine/parser/Compiler.cs +++ b/src/System.Management.Automation/engine/parser/Compiler.cs @@ -446,16 +446,16 @@ namespace System.Management.Automation.Language internal static readonly ConstructorInfo String_ctor_char_int = typeof(string).GetConstructor(new Type[] { typeof(char), typeof(int) }); internal static readonly MethodInfo String_Concat_String = - typeof(string).GetMethod(nameof(String.Concat), staticPublicFlags, null, + typeof(string).GetMethod(nameof(string.Concat), staticPublicFlags, null, CallingConventions.Standard, new Type[] { typeof(string), typeof(string) }, null); internal static readonly MethodInfo String_Equals = - typeof(string).GetMethod(nameof(String.Equals), staticPublicFlags, null, + typeof(string).GetMethod(nameof(string.Equals), staticPublicFlags, null, CallingConventions.Standard, new Type[] { typeof(string), typeof(string), typeof(StringComparison) }, null); internal static readonly MethodInfo String_get_Chars = typeof(string).GetMethod("get_Chars"); internal static readonly PropertyInfo String_Length = - typeof(string).GetProperty(nameof(String.Length)); + typeof(string).GetProperty(nameof(string.Length)); internal static readonly MethodInfo StringOps_Compare = typeof(StringOps).GetMethod(nameof(StringOps.Compare), staticFlags); diff --git a/src/System.Management.Automation/engine/parser/DebugViewWriter.cs b/src/System.Management.Automation/engine/parser/DebugViewWriter.cs index 749685ad3..b640e1647 100644 --- a/src/System.Management.Automation/engine/parser/DebugViewWriter.cs +++ b/src/System.Management.Automation/engine/parser/DebugViewWriter.cs @@ -407,7 +407,7 @@ namespace System.Management.Automation.Language { // prepend # to the operator to represent checked op if (isChecked) { - op = String.Format( + op = string.Format( CultureInfo.CurrentCulture, "#{0}", op @@ -447,7 +447,7 @@ namespace System.Management.Automation.Language { protected override Expression VisitLambda(Expression node) { Out( - String.Format(CultureInfo.CurrentCulture, + string.Format(CultureInfo.CurrentCulture, "{0} {1}<{2}>", ".Lambda", GetLambdaName(node), @@ -506,12 +506,12 @@ namespace System.Management.Automation.Language { if (value == null) { Out("null"); } else if ((value is string) && node.Type == typeof(string)) { - Out(String.Format( + Out(string.Format( CultureInfo.CurrentCulture, "\"{0}\"", value)); } else if ((value is char) && node.Type == typeof(char)) { - Out(String.Format( + Out(string.Format( CultureInfo.CurrentCulture, "'{0}'", value)); @@ -524,7 +524,7 @@ namespace System.Management.Automation.Language { Out(value.ToString()); Out(suffix); } else { - Out(String.Format( + Out(string.Format( CultureInfo.CurrentCulture, ".Constant<{0}>({1})", node.Type.ToString(), @@ -985,7 +985,7 @@ namespace System.Management.Automation.Language { // Display if the type of the BlockExpression is different from the // last expression's type in the block. if (node.Type != node.Expressions[node.Expressions.Count - 1].Type) { - Out(String.Format(CultureInfo.CurrentCulture, "<{0}>", node.Type.ToString())); + Out(string.Format(CultureInfo.CurrentCulture, "<{0}>", node.Type.ToString())); } VisitDeclarations(node.Variables); @@ -1124,7 +1124,7 @@ namespace System.Management.Automation.Language { } protected override Expression VisitExtension(Expression node) { - Out(String.Format(CultureInfo.CurrentCulture, ".Extension<{0}>", node.GetType().ToString())); + Out(string.Format(CultureInfo.CurrentCulture, ".Extension<{0}>", node.GetType().ToString())); if (node.CanReduce) { Out(Flow.Space, "{", Flow.NewLine); @@ -1138,7 +1138,7 @@ namespace System.Management.Automation.Language { } protected override Expression VisitDebugInfo(DebugInfoExpression node) { - Out(String.Format( + Out(string.Format( CultureInfo.CurrentCulture, ".DebugInfo({0}: {1}, {2} - {3}, {4})", node.Document.FileName, @@ -1151,13 +1151,13 @@ namespace System.Management.Automation.Language { } private void DumpLabel(LabelTarget target) { - Out(String.Format(CultureInfo.CurrentCulture, ".LabelTarget {0}:", GetLabelTargetName(target))); + Out(string.Format(CultureInfo.CurrentCulture, ".LabelTarget {0}:", GetLabelTargetName(target))); } private string GetLabelTargetName(LabelTarget target) { if (string.IsNullOrEmpty(target.Name)) { // Create the label target name as #Label1, #Label2, etc. - return String.Format(CultureInfo.CurrentCulture, "#Label{0}", GetLabelTargetId(target)); + return string.Format(CultureInfo.CurrentCulture, "#Label{0}", GetLabelTargetId(target)); } else { return GetDisplayName(target.Name); } @@ -1165,7 +1165,7 @@ namespace System.Management.Automation.Language { private void WriteLambda(LambdaExpression lambda) { Out( - String.Format( + string.Format( CultureInfo.CurrentCulture, ".Lambda {0}<{1}>", GetLambdaName(lambda), @@ -1205,7 +1205,7 @@ namespace System.Management.Automation.Language { } private static string QuoteName(string name) { - return String.Format(CultureInfo.CurrentCulture, "'{0}'", name); + return string.Format(CultureInfo.CurrentCulture, "'{0}'", name); } private static string GetDisplayName(string name) { diff --git a/src/System.Management.Automation/engine/parser/FusionAssemblyIdentity.cs b/src/System.Management.Automation/engine/parser/FusionAssemblyIdentity.cs index 3ea19ad3a..8eebb804d 100644 --- a/src/System.Management.Automation/engine/parser/FusionAssemblyIdentity.cs +++ b/src/System.Management.Automation/engine/parser/FusionAssemblyIdentity.cs @@ -128,7 +128,7 @@ namespace Microsoft.CodeAnalysis hr = nameObject.GetDisplayName(null, ref characterCountIncludingTerminator, displayFlags); if (hr == 0) { - return String.Empty; + return string.Empty; } if (hr != ERROR_INSUFFICIENT_BUFFER) diff --git a/src/System.Management.Automation/engine/parser/PSType.cs b/src/System.Management.Automation/engine/parser/PSType.cs index 4edc241f4..0c26916e8 100644 --- a/src/System.Management.Automation/engine/parser/PSType.cs +++ b/src/System.Management.Automation/engine/parser/PSType.cs @@ -607,7 +607,7 @@ namespace System.Management.Automation.Language getSetAttributes |= Reflection.MethodAttributes.Static; } // C# naming convention for backing fields. - string backingFieldName = String.Format(CultureInfo.InvariantCulture, "<{0}>k__BackingField", propertyMemberAst.Name); + string backingFieldName = string.Format(CultureInfo.InvariantCulture, "<{0}>k__BackingField", propertyMemberAst.Name); var backingField = _typeBuilder.DefineField(backingFieldName, type, backingFieldAttributes); bool hasValidateAttributes = false; @@ -628,7 +628,7 @@ namespace System.Management.Automation.Language PropertyBuilder property = _typeBuilder.DefineProperty(propertyMemberAst.Name, Reflection.PropertyAttributes.None, type, null); // Define the "get" accessor method. - MethodBuilder getMethod = _typeBuilder.DefineMethod(String.Concat("get_", propertyMemberAst.Name), getSetAttributes, type, Type.EmptyTypes); + MethodBuilder getMethod = _typeBuilder.DefineMethod(string.Concat("get_", propertyMemberAst.Name), getSetAttributes, type, Type.EmptyTypes); ILGenerator getIlGen = getMethod.GetILGenerator(); if (propertyMemberAst.IsStatic) { @@ -645,7 +645,7 @@ namespace System.Management.Automation.Language } // Define the "set" accessor method. - MethodBuilder setMethod = _typeBuilder.DefineMethod(String.Concat("set_", propertyMemberAst.Name), getSetAttributes, null, new Type[] { type }); + MethodBuilder setMethod = _typeBuilder.DefineMethod(string.Concat("set_", propertyMemberAst.Name), getSetAttributes, null, new Type[] { type }); ILGenerator setIlGen = setMethod.GetILGenerator(); if (hasValidateAttributes) diff --git a/src/System.Management.Automation/engine/parser/Parser.cs b/src/System.Management.Automation/engine/parser/Parser.cs index c509c894a..149f2cf1c 100644 --- a/src/System.Management.Automation/engine/parser/Parser.cs +++ b/src/System.Management.Automation/engine/parser/Parser.cs @@ -723,7 +723,7 @@ namespace System.Management.Automation.Language { result = null; - if (String.IsNullOrWhiteSpace(input)) + if (string.IsNullOrWhiteSpace(input)) { return false; } @@ -3934,7 +3934,7 @@ namespace System.Management.Automation.Language else if (keywordData.BodyMode == DynamicKeywordBodyMode.Hashtable) { // Resource property value could be set to nested DSC resources except Script resource - bool isScriptResource = String.Compare(functionName.Text, @"Script", StringComparison.OrdinalIgnoreCase) == 0; + bool isScriptResource = string.Compare(functionName.Text, @"Script", StringComparison.OrdinalIgnoreCase) == 0; try { if (isScriptResource) @@ -6039,7 +6039,7 @@ namespace System.Management.Automation.Language exprAst = new StringConstantExpressionAst(genericToken.Extent, genericToken.Value, StringConstantType.BareWord); // If this is a verbatim argument, then don't continue peeking - if (String.Equals(genericToken.Value, VERBATIM_ARGUMENT, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(genericToken.Value, VERBATIM_ARGUMENT, StringComparison.OrdinalIgnoreCase)) { foundVerbatimArgument = true; } @@ -6291,7 +6291,7 @@ namespace System.Management.Automation.Language // If this is the special verbatim argument syntax, look for the next element StringToken argumentToken = token as StringToken; - if ((argumentToken != null) && String.Equals(argumentToken.Value, VERBATIM_ARGUMENT, StringComparison.OrdinalIgnoreCase)) + if ((argumentToken != null) && string.Equals(argumentToken.Value, VERBATIM_ARGUMENT, StringComparison.OrdinalIgnoreCase)) { elements.Add(ast); endExtent = ast.Extent; @@ -7475,14 +7475,14 @@ namespace System.Management.Automation.Language foreach (Type resxType in resxTypes) { string resxErrorBody = resxType.GetProperty(errorId, BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null) as string; - if (String.Equals(errorMsg, resxErrorBody, StringComparison.Ordinal)) + if (string.Equals(errorMsg, resxErrorBody, StringComparison.Ordinal)) { msgCorrespondsToString = true; break; } } - Diagnostics.Assert(msgCorrespondsToString, String.Format("Parser error ID \"{0}\" must correspond to the error message \"{1}\"", errorId, errorMsg)); + Diagnostics.Assert(msgCorrespondsToString, string.Format("Parser error ID \"{0}\" must correspond to the error message \"{1}\"", errorId, errorMsg)); } private static object[] arrayOfOneArg diff --git a/src/System.Management.Automation/engine/parser/Position.cs b/src/System.Management.Automation/engine/parser/Position.cs index 4891b9dc9..193bcfe58 100644 --- a/src/System.Management.Automation/engine/parser/Position.cs +++ b/src/System.Management.Automation/engine/parser/Position.cs @@ -611,7 +611,7 @@ namespace System.Management.Automation.Language if (string.IsNullOrEmpty(line)) { - Line = String.Empty; + Line = string.Empty; } else { @@ -757,7 +757,7 @@ namespace System.Management.Automation.Language } else { - return String.Empty; + return string.Empty; } } } diff --git a/src/System.Management.Automation/engine/parser/SafeValues.cs b/src/System.Management.Automation/engine/parser/SafeValues.cs index 5eaa37654..6bc9ce874 100644 --- a/src/System.Management.Automation/engine/parser/SafeValues.cs +++ b/src/System.Management.Automation/engine/parser/SafeValues.cs @@ -517,8 +517,8 @@ namespace System.Management.Automation.Language // depending on the nested expression we may retrieve a variable, or even need to // execute a sub-expression. The result of which may be returned // as a scalar, array or nested array. If the unwrap of first array doesn't contain a nested - // array we can then pass it to String.Join. If it *does* contain an array, - // we need to unwrap the inner array and pass *that* to String.Join. + // array we can then pass it to string.Join. If it *does* contain an array, + // we need to unwrap the inner array and pass *that* to string.Join. // // This means we get the same answer with GetPowerShell() as in the command-line // { echo "abc $true $(1) $(2,3) def" }.Invoke() gives the same answer as @@ -549,7 +549,7 @@ namespace System.Management.Automation.Language object[] subResult = resultArray[subExpressionOffset] as object[]; if (subResult != null) { - subExpressionResult[subExpressionOffset] = String.Join(ofs, subResult); + subExpressionResult[subExpressionOffset] = string.Join(ofs, subResult); } else // it is a scalar, so we can just add it to our collections { diff --git a/src/System.Management.Automation/engine/parser/SemanticChecks.cs b/src/System.Management.Automation/engine/parser/SemanticChecks.cs index f1e4f9b72..c5ff10d80 100644 --- a/src/System.Management.Automation/engine/parser/SemanticChecks.cs +++ b/src/System.Management.Automation/engine/parser/SemanticChecks.cs @@ -1365,7 +1365,7 @@ namespace System.Management.Automation.Language nameof(ParserStrings.InvalidInstanceProperty), ParserStrings.InvalidInstanceProperty, propName.Value, - String.Join("', '", tableKeys)); + string.Join("', '", tableKeys)); } } } diff --git a/src/System.Management.Automation/engine/parser/SymbolResolver.cs b/src/System.Management.Automation/engine/parser/SymbolResolver.cs index 8ae7f0f62..2e95da9ae 100644 --- a/src/System.Management.Automation/engine/parser/SymbolResolver.cs +++ b/src/System.Management.Automation/engine/parser/SymbolResolver.cs @@ -405,7 +405,7 @@ namespace System.Management.Automation.Language var typeAst = _symbolTable.GetCurrentTypeDefinitionAst(); Diagnostics.Assert(typeAst != null, "Method scopes can exist only inside type definitions."); - string typeString = String.Format(CultureInfo.InvariantCulture, "[{0}]::", typeAst.Name); + string typeString = string.Format(CultureInfo.InvariantCulture, "[{0}]::", typeAst.Name); _parser.ReportError(variableExpressionAst.Extent, nameof(ParserStrings.MissingTypeInStaticPropertyAssignment), ParserStrings.MissingTypeInStaticPropertyAssignment, diff --git a/src/System.Management.Automation/engine/parser/TypeResolver.cs b/src/System.Management.Automation/engine/parser/TypeResolver.cs index 0f87b0d1a..70e22357f 100644 --- a/src/System.Management.Automation/engine/parser/TypeResolver.cs +++ b/src/System.Management.Automation/engine/parser/TypeResolver.cs @@ -488,7 +488,7 @@ namespace System.Management.Automation.Language internal static Type ResolveType(string strTypeName, out Exception exception) { exception = null; - if (String.IsNullOrWhiteSpace(strTypeName)) + if (string.IsNullOrWhiteSpace(strTypeName)) { return null; } diff --git a/src/System.Management.Automation/engine/parser/ast.cs b/src/System.Management.Automation/engine/parser/ast.cs index 142f42ce8..da3a5cec2 100644 --- a/src/System.Management.Automation/engine/parser/ast.cs +++ b/src/System.Management.Automation/engine/parser/ast.cs @@ -206,7 +206,7 @@ namespace System.Management.Automation.Language } catch { - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, AutomationExceptions.CantConvertWithDynamicExpression, this.Extent.Text)); + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, AutomationExceptions.CantConvertWithDynamicExpression, this.Extent.Text)); } } @@ -312,7 +312,7 @@ namespace System.Management.Automation.Language CommandAst commandAst = current as CommandAst; if (commandAst != null && - String.Equals(TokenKind.InlineScript.Text(), commandAst.GetCommandName(), StringComparison.OrdinalIgnoreCase) && + string.Equals(TokenKind.InlineScript.Text(), commandAst.GetCommandName(), StringComparison.OrdinalIgnoreCase) && this != commandAst) { return false; diff --git a/src/System.Management.Automation/engine/parser/tokenizer.cs b/src/System.Management.Automation/engine/parser/tokenizer.cs index 2406f747e..35f4c5a5b 100644 --- a/src/System.Management.Automation/engine/parser/tokenizer.cs +++ b/src/System.Management.Automation/engine/parser/tokenizer.cs @@ -391,7 +391,7 @@ namespace System.Management.Automation.Language internal static IEnumerable GetAllowedKeywords(this DynamicKeyword keyword, IEnumerable allowedKeywords) { string keywordName = keyword.Keyword; - if (String.Compare(keywordName, @"Node", StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(keywordName, @"Node", StringComparison.OrdinalIgnoreCase) == 0) { List excludeKeywords; if (s_excludeKeywords.TryGetValue(keywordName, out excludeKeywords)) diff --git a/src/System.Management.Automation/engine/regex.cs b/src/System.Management.Automation/engine/regex.cs index 0526712f8..bb221230f 100644 --- a/src/System.Management.Automation/engine/regex.cs +++ b/src/System.Management.Automation/engine/regex.cs @@ -218,7 +218,7 @@ namespace System.Management.Automation } else { - s = String.Empty; + s = string.Empty; } return s; @@ -350,7 +350,7 @@ namespace System.Management.Automation } else { - s = String.Empty; + s = string.Empty; } return s; diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index a209ba7f7..a9bb3619e 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -546,7 +546,7 @@ namespace System.Management.Automation /// private static int s_jobIdSeed = 0; - private string _jobTypeName = String.Empty; + private string _jobTypeName = string.Empty; #endregion Private Members @@ -1604,7 +1604,7 @@ namespace System.Management.Automation foreach (Job job in ChildJobs) { - if (String.Equals(job.Location, location, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(job.Location, location, StringComparison.OrdinalIgnoreCase)) { returnJobList.Add(job); } @@ -1909,7 +1909,7 @@ namespace System.Management.Automation { PSRemotingChildJob child = j as PSRemotingChildJob; if (child == null) continue; - if (String.Equals(child.Runspace.ConnectionInfo.ComputerName, computerName, + if (string.Equals(child.Runspace.ConnectionInfo.ComputerName, computerName, StringComparison.OrdinalIgnoreCase)) { returnJobList.Add(child); diff --git a/src/System.Management.Automation/engine/remoting/client/Job2.cs b/src/System.Management.Automation/engine/remoting/client/Job2.cs index 82fe542e3..969032693 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job2.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job2.cs @@ -2076,7 +2076,7 @@ namespace System.Management.Automation _tracer.WriteMessage("Unregistering StateChanged event for job ", job.InstanceId); foreach (PSEventSubscriber subscriber in - EventManager.Subscribers.Where(subscriber => String.Equals(subscriber.SourceIdentifier, sourceIdentifier, StringComparison.OrdinalIgnoreCase))) + EventManager.Subscribers.Where(subscriber => string.Equals(subscriber.SourceIdentifier, sourceIdentifier, StringComparison.OrdinalIgnoreCase))) { EventManager.UnsubscribeEvent(subscriber); break; diff --git a/src/System.Management.Automation/engine/remoting/client/JobManager.cs b/src/System.Management.Automation/engine/remoting/client/JobManager.cs index 4d1cbec7c..062c8d6dc 100644 --- a/src/System.Management.Automation/engine/remoting/client/JobManager.cs +++ b/src/System.Management.Automation/engine/remoting/client/JobManager.cs @@ -90,7 +90,7 @@ namespace System.Management.Automation ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(PSTypeExtensions.EmptyTypes); if (!constructor.IsPublic) { - string message = String.Format(CultureInfo.CurrentCulture, + string message = string.Format(CultureInfo.CurrentCulture, RemotingErrorIdStrings.JobManagerRegistrationConstructorError, jobSourceAdapterType.FullName); throw new InvalidOperationException(message); @@ -860,7 +860,7 @@ namespace System.Management.Automation else { // Write a warning - string message = String.Format(CultureInfo.CurrentCulture, + string message = string.Format(CultureInfo.CurrentCulture, RemotingErrorIdStrings.JobSourceAdapterError, exception.Message, sourceAdapter.Name); diff --git a/src/System.Management.Automation/engine/remoting/client/JobSourceAdapter.cs b/src/System.Management.Automation/engine/remoting/client/JobSourceAdapter.cs index 3342d2516..7f21430ab 100644 --- a/src/System.Management.Automation/engine/remoting/client/JobSourceAdapter.cs +++ b/src/System.Management.Automation/engine/remoting/client/JobSourceAdapter.cs @@ -379,7 +379,7 @@ namespace System.Management.Automation /// /// Name for this store /// - public string Name { get; set; } = String.Empty; + public string Name { get; set; } = string.Empty; /// /// Get a token that allows for construction of a job with a previously assigned diff --git a/src/System.Management.Automation/engine/remoting/client/PSProxyJob.cs b/src/System.Management.Automation/engine/remoting/client/PSProxyJob.cs index d4a065efe..fb94e253e 100644 --- a/src/System.Management.Automation/engine/remoting/client/PSProxyJob.cs +++ b/src/System.Management.Automation/engine/remoting/client/PSProxyJob.cs @@ -799,7 +799,7 @@ namespace System.Management.Automation continue; } - string command = String.Empty; + string command = string.Empty; if (!TryGetJobPropertyValue(deserializedJob, "Command", out command)) { Dbg.Assert(false, "Job object did not contain command when creating proxy."); @@ -1604,7 +1604,7 @@ namespace System.Management.Automation { var newState = JobState.Failed; var reason = e.InvocationStateInfo.Reason == null - ? String.Empty + ? string.Empty : e.InvocationStateInfo.Reason.ToString(); _tracer.WriteMessage(ClassNameTrace, "ReceivePowerShellInvocationStateChanged", _remoteJobInstanceId, this, "Setting job state to {0} old state was {1} and reason is {2}.", newState.ToString(), JobStateInfo.State.ToString(), reason); @@ -2490,8 +2490,8 @@ namespace System.Management.Automation private EventHandler _stateChangedHandler; private const string ResBaseName = "PowerShellStrings"; private Guid _remoteJobInstanceId = Guid.Empty; - private string _remoteJobStatusMessage = String.Empty; - private string _remoteJobLocation = String.Empty; + private string _remoteJobStatusMessage = string.Empty; + private string _remoteJobLocation = string.Empty; private readonly Hashtable _childJobsMapping = new Hashtable(); private readonly PowerShell _receivePowerShell = PowerShell.Create(); private readonly PSDataCollection _receivePowerShellOutput = new PSDataCollection(); diff --git a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs index cc1d0ae50..0f6bfcf72 100644 --- a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs +++ b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs @@ -1957,7 +1957,7 @@ namespace System.Management.Automation.Runspaces.Internal /// /// Remote command string. /// - public string Command { get; } = String.Empty; + public string Command { get; } = string.Empty; /// /// Constructs a remote command object. diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index bdd783715..b1425b4ab 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -2654,7 +2654,7 @@ namespace System.Management.Automation } catch (RemoteException e) { - if (String.Equals("CommandNotFoundException", e.ErrorRecord.FullyQualifiedErrorId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("CommandNotFoundException", e.ErrorRecord.FullyQualifiedErrorId, StringComparison.OrdinalIgnoreCase)) { _setVariableCommandNotFoundException = new PSNotSupportedException(RunspaceStrings.NotSupportedOnRestrictedRunspace, e); throw _setVariableCommandNotFoundException; @@ -2714,7 +2714,7 @@ namespace System.Management.Automation } catch (RemoteException e) { - if (String.Equals("CommandNotFoundException", e.ErrorRecord.FullyQualifiedErrorId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("CommandNotFoundException", e.ErrorRecord.FullyQualifiedErrorId, StringComparison.OrdinalIgnoreCase)) { _getVariableCommandNotFoundException = new PSNotSupportedException(RunspaceStrings.NotSupportedOnRestrictedRunspace, e); throw _getVariableCommandNotFoundException; diff --git a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs index 55f971a36..339c00948 100644 --- a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs +++ b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs @@ -659,7 +659,7 @@ namespace System.Management.Automation.Remoting case RemotingDataType.PublicKeyRequest: { - PublicKeyRequestReceived.SafeInvoke(this, new RemoteDataEventArgs(String.Empty)); + PublicKeyRequestReceived.SafeInvoke(this, new RemoteDataEventArgs(string.Empty)); } break; diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index 7a1abbb49..fdc2d3b9c 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -1528,7 +1528,7 @@ else internal static string GetWinrmPluginShellName() { // PowerShell Core uses a versioned directory to hold the plugin - return System.String.Concat("PowerShell.", PSVersionInfo.GitCommitId); + return string.Concat("PowerShell.", PSVersionInfo.GitCommitId); } /// @@ -3486,7 +3486,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5] // if (UseSharedProcess == false && psObjectCollection[0] != null && - String.Compare(psObjectCollection[0].ToString(), "Workflow", StringComparison.OrdinalIgnoreCase) == 0) + string.Compare(psObjectCollection[0].ToString(), "Workflow", StringComparison.OrdinalIgnoreCase) == 0) { throw new PSInvalidOperationException(RemotingErrorIdStrings.UseSharedProcessCannotBeFalseForWorkflowSessionType); } diff --git a/src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs b/src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs index 2624baeac..a57caa317 100644 --- a/src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs @@ -702,7 +702,7 @@ namespace Microsoft.PowerShell.Commands if (string.IsNullOrEmpty(appDomainName)) { throw new PSArgumentNullException("appDomainName"); } #if !CORECLR - MainWindowTitle = String.Empty; + MainWindowTitle = string.Empty; try { var proc = Process.GetProcessById(processId); diff --git a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs index 19195587b..5e20a0d71 100644 --- a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs @@ -502,7 +502,7 @@ namespace Microsoft.PowerShell.Commands } } - private string _name = String.Empty; + private string _name = string.Empty; /// /// The script block that the user has specified in the @@ -932,8 +932,8 @@ namespace Microsoft.PowerShell.Commands } else { - // convert null to String.Empty for VM/Container session - ConfigurationName = String.Empty; + // convert null to string.Empty for VM/Container session + ConfigurationName = string.Empty; } } diff --git a/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs b/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs index df2e51976..1d038ee5f 100644 --- a/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs +++ b/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs @@ -976,9 +976,9 @@ namespace Microsoft.PowerShell.Commands foreach (string functionKey in hashtable.Keys) { - if (!String.Equals(functionKey, ConfigFileConstants.FunctionNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(functionKey, ConfigFileConstants.FunctionValueToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(functionKey, ConfigFileConstants.FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(functionKey, ConfigFileConstants.FunctionNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(functionKey, ConfigFileConstants.FunctionValueToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(functionKey, ConfigFileConstants.FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, functionKey, ConfigFileConstants.FunctionDefinitions, _path)); @@ -1040,8 +1040,8 @@ namespace Microsoft.PowerShell.Commands foreach (string variableKey in hashtable.Keys) { - if (!String.Equals(variableKey, ConfigFileConstants.VariableNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(variableKey, ConfigFileConstants.VariableValueToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(variableKey, ConfigFileConstants.VariableNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(variableKey, ConfigFileConstants.VariableValueToken, StringComparison.OrdinalIgnoreCase)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, variableKey, ConfigFileConstants.VariableDefinitions, _path)); @@ -1723,9 +1723,9 @@ namespace Microsoft.PowerShell.Commands foreach (string functionKey in hashtable.Keys) { - if (!String.Equals(functionKey, ConfigFileConstants.FunctionNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(functionKey, ConfigFileConstants.FunctionValueToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(functionKey, ConfigFileConstants.FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(functionKey, ConfigFileConstants.FunctionNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(functionKey, ConfigFileConstants.FunctionValueToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(functionKey, ConfigFileConstants.FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, functionKey, ConfigFileConstants.FunctionDefinitions, _path)); @@ -1784,8 +1784,8 @@ namespace Microsoft.PowerShell.Commands foreach (string variableKey in hashtable.Keys) { - if (!String.Equals(variableKey, ConfigFileConstants.VariableNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(variableKey, ConfigFileConstants.VariableValueToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(variableKey, ConfigFileConstants.VariableNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(variableKey, ConfigFileConstants.VariableValueToken, StringComparison.OrdinalIgnoreCase)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, variableKey, ConfigFileConstants.VariableDefinitions, _path)); diff --git a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs index ba72085b1..e30d5c622 100644 --- a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs +++ b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs @@ -93,7 +93,7 @@ namespace Microsoft.PowerShell.Commands { Diagnostics.Assert(computerName != null, "Null ComputerName"); - if (String.Equals(computerName, ".", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(computerName, ".", StringComparison.OrdinalIgnoreCase)) { //tracer.WriteEvent(ref PSEventDescriptors.PS_EVENT_HOSTNAMERESOLVE); //tracer.Dispose(); @@ -864,7 +864,7 @@ namespace Microsoft.PowerShell.Commands Uri uri = new System.Uri("ssh://" + hostname); host = ResolveComputerName(uri.Host); ValidateComputerName(new string[] { host }); - if (uri.UserInfo != String.Empty) + if (uri.UserInfo != string.Empty) { userName = uri.UserInfo; } @@ -916,7 +916,7 @@ namespace Microsoft.PowerShell.Commands var resolvedComputerName = ResolveComputerName(GetSSHConnectionStringParameter(item[paramName])); ParseSshHostName(resolvedComputerName, out string host, out string userName, out int port); connectionInfo.ComputerName = host; - if (userName != String.Empty) + if (userName != string.Empty) { connectionInfo.UserName = userName; } diff --git a/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs b/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs index fc8140e78..598b659c1 100644 --- a/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs @@ -220,8 +220,8 @@ namespace Microsoft.PowerShell.Commands } else { - // convert null to String.Empty for VM/Container session - ConfigurationName = String.Empty; + // convert null to string.Empty for VM/Container session + ConfigurationName = string.Empty; } } } diff --git a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs index 4fc242974..7dd3db425 100644 --- a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs @@ -141,7 +141,7 @@ namespace Microsoft.PowerShell.Commands // check if the job is available in any of the // top level jobs - //if (String.Equals(job.Name, name, StringComparison.OrdinalIgnoreCase)) + //if (string.Equals(job.Name, name, StringComparison.OrdinalIgnoreCase)) if (pattern.IsMatch(job.Name)) { jobFound = true; diff --git a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs index c807e91ad..849f1eac2 100644 --- a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs @@ -187,8 +187,8 @@ namespace Microsoft.PowerShell.Commands } else { - // convert null to String.Empty for VM/Container session - ConfigurationName = String.Empty; + // convert null to string.Empty for VM/Container session + ConfigurationName = string.Empty; } } } @@ -526,7 +526,7 @@ namespace Microsoft.PowerShell.Commands if (WSManNativeApi.ERROR_WSMAN_NO_LOGON_SESSION_EXIST == transErrorCode) { - errorDetails += System.Environment.NewLine + String.Format(System.Globalization.CultureInfo.CurrentCulture, RemotingErrorIdStrings.RemotingErrorNoLogonSessionExist); + errorDetails += System.Environment.NewLine + string.Format(System.Globalization.CultureInfo.CurrentCulture, RemotingErrorIdStrings.RemotingErrorNoLogonSessionExist); } ErrorRecord errorRecord = new ErrorRecord(reason, diff --git a/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs b/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs index 9471b613d..c8b10d3af 100644 --- a/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs +++ b/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs @@ -574,7 +574,7 @@ namespace System.Management.Automation.Remoting // // Credential is invalid. // - if (String.Compare(responseString, "FAIL", StringComparison.Ordinal) == 0) + if (string.Compare(responseString, "FAIL", StringComparison.Ordinal) == 0) { HyperVSocket.Send(response); @@ -585,7 +585,7 @@ namespace System.Management.Automation.Remoting // // If PowerShell Direct in VM supports configuration, send configuration name. // - if (String.Compare(responseString, "CONF", StringComparison.Ordinal) == 0) + if (string.Compare(responseString, "CONF", StringComparison.Ordinal) == 0) { if (emptyConfiguration) { diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index e41e5137a..156e061f4 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -1187,7 +1187,7 @@ namespace System.Management.Automation.Runspaces } //default host is localhost - if (string.IsNullOrEmpty(computerName) || String.Equals(computerName, ".", StringComparison.OrdinalIgnoreCase)) + if (string.IsNullOrEmpty(computerName) || string.Equals(computerName, ".", StringComparison.OrdinalIgnoreCase)) { _computerName = DefaultComputerName; } @@ -2556,7 +2556,7 @@ namespace System.Management.Automation.Runspaces try { - var cmdLine = String.Format(CultureInfo.InvariantCulture, @"""{0}"" {1}", startInfo.FileName, startInfo.Arguments); + var cmdLine = string.Format(CultureInfo.InvariantCulture, @"""{0}"" {1}", startInfo.FileName, startInfo.Arguments); lpStartupInfo.hStdInput = new SafeFileHandle(stdInPipeClient.DangerousGetHandle(), false); lpStartupInfo.hStdOutput = new SafeFileHandle(stdOutPipeClient.DangerousGetHandle(), false); @@ -3273,7 +3273,7 @@ namespace System.Management.Automation.Runspaces try { IntPtr ComputeSystem = IntPtr.Zero; - string resultString = String.Empty; + string resultString = string.Empty; result = HcsOpenComputeSystem(ContainerId, ref ComputeSystem, ref resultString); if (result != 0) @@ -3381,7 +3381,7 @@ namespace System.Management.Automation.Runspaces private void TerminateContainerProcessInternal() { IntPtr ComputeSystem = IntPtr.Zero; - string resultString = String.Empty; + string resultString = string.Empty; IntPtr process = IntPtr.Zero; ProcessTerminated = false; @@ -3406,7 +3406,7 @@ namespace System.Management.Automation.Runspaces try { IntPtr ComputeSystem = IntPtr.Zero; - string resultString = String.Empty; + string resultString = string.Empty; if (HcsOpenComputeSystem(ContainerId, ref ComputeSystem, ref resultString) == 0) { diff --git a/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs b/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs index 5daaf3a53..7493ee5cd 100644 --- a/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs +++ b/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs @@ -496,7 +496,7 @@ namespace System.Management.Automation.Remoting.Internal internal static ErrorRecord AddSourceTagToError(ErrorRecord errorRecord, Guid sourceId) { if (errorRecord == null) return null; - if (errorRecord.ErrorDetails == null) errorRecord.ErrorDetails = new ErrorDetails(String.Empty); + if (errorRecord.ErrorDetails == null) errorRecord.ErrorDetails = new ErrorDetails(string.Empty); errorRecord.ErrorDetails.RecommendedAction = CreateInformationalMessage(sourceId, errorRecord.ErrorDetails.RecommendedAction); return errorRecord; } diff --git a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs index 3d32f9008..f65659097 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs @@ -1008,7 +1008,7 @@ namespace System.Management.Automation.Remoting foreach (ConfigTypeEntry configEntry in ConfigFileKeys) { - if (String.Equals(configEntry.Key, de.Key.ToString(), StringComparison.OrdinalIgnoreCase)) + if (string.Equals(configEntry.Key, de.Key.ToString(), StringComparison.OrdinalIgnoreCase)) { validKey = true; @@ -1173,10 +1173,10 @@ namespace System.Management.Automation.Remoting foreach (string aliasKey in hashtable.Keys) { - if (!String.Equals(aliasKey, AliasNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(aliasKey, AliasValueToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(aliasKey, AliasDescriptionToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(aliasKey, AliasOptionsToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(aliasKey, AliasNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(aliasKey, AliasValueToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(aliasKey, AliasDescriptionToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(aliasKey, AliasOptionsToken, StringComparison.OrdinalIgnoreCase)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, aliasKey, key, path)); return false; @@ -1226,9 +1226,9 @@ namespace System.Management.Automation.Remoting foreach (string functionKey in hashtable.Keys) { - if (!String.Equals(functionKey, FunctionNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(functionKey, FunctionValueToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(functionKey, FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(functionKey, FunctionNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(functionKey, FunctionValueToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(functionKey, FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, functionKey, key, path)); return false; @@ -1272,8 +1272,8 @@ namespace System.Management.Automation.Remoting foreach (string variableKey in hashtable.Keys) { - if (!String.Equals(variableKey, VariableNameToken, StringComparison.OrdinalIgnoreCase) && - !String.Equals(variableKey, VariableValueToken, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(variableKey, VariableNameToken, StringComparison.OrdinalIgnoreCase) && + !string.Equals(variableKey, VariableValueToken, StringComparison.OrdinalIgnoreCase)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, variableKey, key, path)); return false; @@ -1549,7 +1549,7 @@ namespace System.Management.Automation.Remoting !ext.Equals(StringLiterals.PowerShellModuleFileExtension, StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.DISCInvalidExtension, key, ext, - String.Join(", ", StringLiterals.PowerShellScriptFileExtension, StringLiterals.PowerShellModuleFileExtension))); + string.Join(", ", StringLiterals.PowerShellScriptFileExtension, StringLiterals.PowerShellModuleFileExtension))); } } catch (ArgumentException argumentException) @@ -2563,7 +2563,7 @@ namespace System.Management.Automation.Remoting foreach (string parameterModification in parameter.Keys) { - if (String.Equals("Name", parameterModification, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("Name", parameterModification, StringComparison.OrdinalIgnoreCase)) { continue; } @@ -2780,7 +2780,7 @@ namespace System.Management.Automation.Remoting return table[key].ToString(); } - return String.Empty; + return string.Empty; } /// diff --git a/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs index f88612e5d..bee450d54 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs @@ -1413,7 +1413,7 @@ namespace System.Management.Automation.Remoting.Client internal override void CreateAsync() { _client = new RemoteSessionHyperVSocketClient(_targetGuid, false, true); - if (!_client.Connect(null, String.Empty, false)) + if (!_client.Connect(null, string.Empty, false)) { _client.Dispose(); throw new PSInvalidOperationException( diff --git a/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs b/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs index 95e0de32a..dcb588c90 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs @@ -107,7 +107,7 @@ namespace System.Management.Automation.Remoting string optionName = reader.Value; - if (String.Equals(optionName, PrivateDataToken, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(optionName, PrivateDataToken, StringComparison.OrdinalIgnoreCase)) { // this is a PrivateData element which we // need to process diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs index afabb3da6..375071b5b 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs @@ -792,7 +792,7 @@ namespace System.Management.Automation.Remoting.Client if (this.Type == (uint)WSManDataType.WSMAN_DATA_TYPE_TEXT) return _text; else - return String.Empty; + return string.Empty; } } diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs index 141cc4978..8a30b121a 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs @@ -199,7 +199,7 @@ namespace System.Management.Automation.Remoting RemotingErrorIdStrings.WSManPluginNullInvalidInput, "requestDetails", "WSManPluginShell"), - String.Empty); + string.Empty); return; } @@ -607,7 +607,7 @@ namespace System.Management.Automation.Remoting RemotingErrorIdStrings.WSManPluginNullInvalidInput, "requestDetails", inputFunctionName), - String.Empty); + string.Empty); return false; } @@ -686,7 +686,7 @@ namespace System.Management.Automation.Remoting RemotingErrorIdStrings.WSManPluginNullInvalidInput, "requestDetails", "StopCommand"), - String.Empty); + string.Empty); return; } @@ -1036,7 +1036,7 @@ namespace System.Management.Automation.Remoting { WSManNativeApi.WSManOption option = options[i]; - if (String.Equals(option.name, WSManPluginConstants.PowerShellStartupProtocolVersionName, StringComparison.Ordinal)) + if (string.Equals(option.name, WSManPluginConstants.PowerShellStartupProtocolVersionName, StringComparison.Ordinal)) { if (!EnsureProtocolVersionComplies(requestDetails, option.value)) { @@ -1046,7 +1046,7 @@ namespace System.Management.Automation.Remoting isProtocolVersionDeclared = true; } - if (0 == String.Compare(option.name, 0, WSManPluginConstants.PowerShellOptionPrefix, 0, WSManPluginConstants.PowerShellOptionPrefix.Length, StringComparison.Ordinal)) + if (0 == string.Compare(option.name, 0, WSManPluginConstants.PowerShellOptionPrefix, 0, WSManPluginConstants.PowerShellOptionPrefix.Length, StringComparison.Ordinal)) { if (option.mustComply) { @@ -1089,7 +1089,7 @@ namespace System.Management.Automation.Remoting WSManNativeApi.WSManPluginRequest requestDetails, string clientVersionString) { - if (String.Equals(clientVersionString, WSManPluginConstants.PowerShellStartupProtocolVersionValue, StringComparison.Ordinal)) + if (string.Equals(clientVersionString, WSManPluginConstants.PowerShellStartupProtocolVersionValue, StringComparison.Ordinal)) { return true; } @@ -1282,7 +1282,7 @@ namespace System.Management.Automation.Remoting // Close Command if (IntPtr.Zero != commandContext) { - if (!String.Equals(code, WSManPluginConstants.CtrlCSignal, StringComparison.Ordinal)) + if (!string.Equals(code, WSManPluginConstants.CtrlCSignal, StringComparison.Ordinal)) { // Close operations associated with this command.. WSManPluginOperationShutdownContext cmdCtxt = new WSManPluginOperationShutdownContext(pluginContext, shellContext, commandContext, false); @@ -1404,8 +1404,8 @@ namespace System.Management.Automation.Remoting PSKeyword.ManagedPlugin | PSKeyword.UseAlwaysAnalytic, (requestDetails.unmanagedHandle).ToString(), Convert.ToString(errorCode, CultureInfo.InvariantCulture), - String.Empty, - String.Empty); + string.Empty, + string.Empty); ReportOperationComplete(requestDetails.unmanagedHandle, errorCode); } @@ -1422,8 +1422,8 @@ namespace System.Management.Automation.Remoting Dbg.Assert(requestDetails != null, "requestDetails cannot be null in operation complete."); WSManPluginErrorCodes error = WSManPluginErrorCodes.NoError; - string errorMessage = String.Empty; - string stackTrace = String.Empty; + string errorMessage = string.Empty; + string stackTrace = string.Empty; if (reasonForClose != null) { diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs index 8b99a4b6a..e4dd4c7c8 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs @@ -132,8 +132,8 @@ namespace System.Management.Automation.Remoting string stream, WSManNativeApi.WSManData_UnToMan inboundData) { - if ((!String.Equals(stream, WSManPluginConstants.SupportedInputStream, StringComparison.Ordinal)) && - (!String.Equals(stream, WSManPluginConstants.SupportedPromptResponseStream, StringComparison.Ordinal))) + if ((!string.Equals(stream, WSManPluginConstants.SupportedInputStream, StringComparison.Ordinal)) && + (!string.Equals(stream, WSManPluginConstants.SupportedPromptResponseStream, StringComparison.Ordinal))) { WSManPluginInstance.ReportOperationComplete( requestDetails, @@ -215,7 +215,7 @@ namespace System.Management.Automation.Remoting return false; } - if (!String.Equals(streamSet.streamIDs[0], WSManPluginConstants.SupportedOutputStream, StringComparison.Ordinal)) + if (!string.Equals(streamSet.streamIDs[0], WSManPluginConstants.SupportedOutputStream, StringComparison.Ordinal)) { // only "stdout" is the supported output stream. WSManPluginInstance.ReportOperationComplete( @@ -473,7 +473,7 @@ namespace System.Management.Automation.Remoting _remoteSession.ExecuteConnect(inputData, out outputData); //construct Xml to send back - string responseData = String.Format(System.Globalization.CultureInfo.InvariantCulture, + string responseData = string.Format(System.Globalization.CultureInfo.InvariantCulture, "<{0} xmlns=\"{1}\">{2}", WSManNativeApi.PS_CONNECTRESPONSE_XML_TAG, WSManNativeApi.PS_XML_NAMESPACE, diff --git a/src/System.Management.Automation/engine/runtime/Binding/Binders.cs b/src/System.Management.Automation/engine/runtime/Binding/Binders.cs index cfb9dffde..ec22bc75b 100644 --- a/src/System.Management.Automation/engine/runtime/Binding/Binders.cs +++ b/src/System.Management.Automation/engine/runtime/Binding/Binders.cs @@ -1039,7 +1039,7 @@ namespace System.Management.Automation.Language /// This binder is used to convert objects to string in specific circumstances, including: /// /// * The LHS of a format expression. The arguments (the RHS objects) of the format - /// expression are not converted to string here, that is defered to String.Format which + /// expression are not converted to string here, that is defered to string.Format which /// may have some custom formatting to apply. /// * The objects passed to the format expression as part of an expandable string. In this /// case, the format string is generated by the parser, so we know that there is no custom @@ -5495,7 +5495,7 @@ namespace System.Management.Automation.Language internal static bool IsAllowedInConstrainedLanguage(Object targetValue, string name, bool isStatic) { // ToString allowed on any type - if (String.Equals(name, "ToString", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "ToString", StringComparison.OrdinalIgnoreCase)) { return true; } diff --git a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs index 1b3b6c698..58419b530 100644 --- a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs +++ b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs @@ -1443,7 +1443,7 @@ namespace System.Management.Automation string errorMessage = StringUtil.Format(SecuritySupportStrings.CouldNotEncryptContent, textToLog, error.ToString()); PSEtwLog.LogOperationalError(PSEventId.ScriptBlock_Compile_Detail, PSOpcode.Create, PSTask.ExecuteCommand, PSKeyword.UseAlwaysOperational, - 0, 0, errorMessage, scriptBlock.Id.ToString(), scriptBlock.File ?? String.Empty); + 0, 0, errorMessage, scriptBlock.Id.ToString(), scriptBlock.File ?? string.Empty); } else { @@ -1466,12 +1466,12 @@ namespace System.Management.Automation if (scriptBlock._scriptBlockData.HasSuspiciousContent) { PSEtwLog.LogOperationalWarning(PSEventId.ScriptBlock_Compile_Detail, PSOpcode.Create, PSTask.ExecuteCommand, PSKeyword.UseAlwaysOperational, - segment + 1, segments, textToLog, scriptBlock.Id.ToString(), scriptBlock.File ?? String.Empty); + segment + 1, segments, textToLog, scriptBlock.Id.ToString(), scriptBlock.File ?? string.Empty); } else { PSEtwLog.LogOperationalVerbose(PSEventId.ScriptBlock_Compile_Detail, PSOpcode.Create, PSTask.ExecuteCommand, PSKeyword.UseAlwaysOperational, - segment + 1, segments, textToLog, scriptBlock.Id.ToString(), scriptBlock.File ?? String.Empty); + segment + 1, segments, textToLog, scriptBlock.Id.ToString(), scriptBlock.File ?? string.Empty); } return true; @@ -1503,7 +1503,7 @@ namespace System.Management.Automation return false; } - string fullCertificateContent = String.Join(Environment.NewLine, logSetting.EncryptionCertificate); + string fullCertificateContent = string.Join(Environment.NewLine, logSetting.EncryptionCertificate); // If the certificate has changed, drop all of our cached information ResetCertificateCacheIfNeeded(fullCertificateContent); @@ -1537,7 +1537,7 @@ namespace System.Management.Automation // they can just wait on the compromised box and see the sensitive data eventually anyways. string errorMessage = StringUtil.Format(SecuritySupportStrings.CouldNotUseCertificate, error.ToString()); PSEtwLog.LogOperationalError(PSEventId.ScriptBlock_Compile_Detail, PSOpcode.Create, PSTask.ExecuteCommand, PSKeyword.UseAlwaysOperational, - 0, 0, errorMessage, scriptBlock.Id.ToString(), scriptBlock.File ?? String.Empty); + 0, 0, errorMessage, scriptBlock.Id.ToString(), scriptBlock.File ?? string.Empty); return true; } @@ -1562,7 +1562,7 @@ namespace System.Management.Automation string errorMessage = StringUtil.Format(SecuritySupportStrings.CertificateContainsPrivateKey, certificateForLog); PSEtwLog.LogOperationalError(PSEventId.ScriptBlock_Compile_Detail, PSOpcode.Create, PSTask.ExecuteCommand, PSKeyword.UseAlwaysOperational, - 0, 0, errorMessage, scriptBlock.Id.ToString(), scriptBlock.File ?? String.Empty); + 0, 0, errorMessage, scriptBlock.Id.ToString(), scriptBlock.File ?? string.Empty); } } } @@ -1572,14 +1572,14 @@ namespace System.Management.Automation } private static object s_syncObject = new Object(); - private static string s_lastSeenCertificate = String.Empty; + private static string s_lastSeenCertificate = string.Empty; private static bool s_hasProcessedCertificate = false; private static CmsMessageRecipient[] s_encryptionRecipients = null; // Reset any static caches if the certificate has changed private static void ResetCertificateCacheIfNeeded(string certificate) { - if (!String.Equals(s_lastSeenCertificate, certificate, StringComparison.Ordinal)) + if (!string.Equals(s_lastSeenCertificate, certificate, StringComparison.Ordinal)) { s_hasProcessedCertificate = false; s_lastSeenCertificate = certificate; diff --git a/src/System.Management.Automation/engine/runtime/MutableTuple.cs b/src/System.Management.Automation/engine/runtime/MutableTuple.cs index a1ee8e9d8..c3db7a9bb 100644 --- a/src/System.Management.Automation/engine/runtime/MutableTuple.cs +++ b/src/System.Management.Automation/engine/runtime/MutableTuple.cs @@ -366,7 +366,7 @@ namespace System.Management.Automation foreach (int curIndex in GetAccessPath(size, index)) { - PropertyInfo pi = tupleType.GetProperty("Item" + String.Format(CultureInfo.InvariantCulture, "{0:D3}", curIndex)); + PropertyInfo pi = tupleType.GetProperty("Item" + string.Format(CultureInfo.InvariantCulture, "{0:D3}", curIndex)); Diagnostics.Assert(pi != null, "reflection should always find Item"); yield return pi; tupleType = pi.PropertyType; @@ -437,7 +437,7 @@ namespace System.Management.Automation for (int i = 0; i < size; i++) { - PropertyInfo pi = tupleType.GetProperty("Item" + String.Format(CultureInfo.InvariantCulture, "{0:D3}", i)); + PropertyInfo pi = tupleType.GetProperty("Item" + string.Format(CultureInfo.InvariantCulture, "{0:D3}", i)); res.SetValueImpl(i, MakeTuple(pi.PropertyType, null, null)); } } @@ -537,7 +537,7 @@ namespace System.Management.Automation int newStart = start + (i * multiplier); int newEnd = System.Math.Min(end, start + ((i + 1) * multiplier)); - PropertyInfo pi = tupleType.GetProperty("Item" + String.Format(CultureInfo.InvariantCulture, "{0:D3}", i)); + PropertyInfo pi = tupleType.GetProperty("Item" + string.Format(CultureInfo.InvariantCulture, "{0:D3}", i)); newValues[i] = CreateNew(pi.PropertyType, newStart, newEnd, values); } diff --git a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs index d9938bd5e..76d3db3be 100644 --- a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs +++ b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs @@ -1135,7 +1135,7 @@ namespace System.Management.Automation internal Pipe GetRedirectionPipe(ExecutionContext context, PipelineProcessor parentPipelineProcessor) { - if (String.IsNullOrWhiteSpace(File)) + if (string.IsNullOrWhiteSpace(File)) { return new Pipe { NullPipe = true }; } diff --git a/src/System.Management.Automation/engine/runtime/Operations/StringOps.cs b/src/System.Management.Automation/engine/runtime/Operations/StringOps.cs index da826201a..eeb71366b 100644 --- a/src/System.Management.Automation/engine/runtime/Operations/StringOps.cs +++ b/src/System.Management.Automation/engine/runtime/Operations/StringOps.cs @@ -36,7 +36,7 @@ namespace System.Management.Automation if (times == 0 || s.Length == 0) { - return String.Empty; + return string.Empty; } var context = LocalPipeline.GetExecutionContextFromTLS(); @@ -84,7 +84,7 @@ namespace System.Management.Automation /// StringComparison.InvariantCulture is not in CoreCLR, so we need to use /// CultureInfo.InvariantCulture.CompareInfo.Compare(string, string, CompareOptions) /// to substitute - /// String.Compare(string, string, StringComparison) + /// string.Compare(string, string, StringComparison) /// internal static int Compare(string strA, string strB, CultureInfo culture, CompareOptions option) { @@ -96,7 +96,7 @@ namespace System.Management.Automation /// StringComparison.InvariantCulture is not in CoreCLR, so we need to use /// CultureInfo.InvariantCulture.CompareInfo.Compare(string, string, CompareOptions) == 0 /// to substitute - /// String.Equals(string, string, StringComparison) + /// string.Equals(string, string, StringComparison) /// internal static bool Equals(string strA, string strB, CultureInfo culture, CompareOptions option) { @@ -104,4 +104,4 @@ namespace System.Management.Automation return culture.CompareInfo.Compare(strA, strB, option) == 0; } } -} \ No newline at end of file +} diff --git a/src/System.Management.Automation/help/CommandHelpProvider.cs b/src/System.Management.Automation/help/CommandHelpProvider.cs index fcaa8ee36..b91225191 100644 --- a/src/System.Management.Automation/help/CommandHelpProvider.cs +++ b/src/System.Management.Automation/help/CommandHelpProvider.cs @@ -696,7 +696,7 @@ namespace System.Management.Automation for (int i = 0; i < doc.ChildNodes.Count; i++) { XmlNode node = doc.ChildNodes[i]; - if (node.NodeType == XmlNodeType.Element && String.Compare(node.LocalName, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.LocalName, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) { helpItemsNode = node; break; @@ -719,7 +719,7 @@ namespace System.Management.Automation for (int i = 0; i < helpItemsNode.ChildNodes.Count; i++) { XmlNode node = helpItemsNode.ChildNodes[i]; - if (node.NodeType == XmlNodeType.Element && String.Compare(node.LocalName, "command", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.LocalName, "command", StringComparison.OrdinalIgnoreCase) == 0) { MamlCommandHelpInfo helpInfo = null; @@ -735,7 +735,7 @@ namespace System.Management.Automation } } - if (node.NodeType == XmlNodeType.Element && String.Compare(node.Name, "UserDefinedData", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.Name, "UserDefinedData", StringComparison.OrdinalIgnoreCase) == 0) { UserDefinedHelpData userDefinedHelpData = UserDefinedHelpData.Load(node); diff --git a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs index 358543a27..e7a550a81 100644 --- a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs +++ b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs @@ -57,8 +57,8 @@ namespace System.Management.Automation.Help PSObject obj = new PSObject(); obj.TypeNames.Clear(); - obj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#{1}#command", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp, commandInfo.ModuleName)); - obj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#{1}", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp, commandInfo.ModuleName)); + obj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#{1}#command", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp, commandInfo.ModuleName)); + obj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#{1}", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp, commandInfo.ModuleName)); obj.TypeNames.Add(DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp); obj.TypeNames.Add("CmdletHelpInfo"); obj.TypeNames.Add("HelpInfo"); @@ -107,7 +107,7 @@ namespace System.Management.Automation.Help bool common = HasCommonParameters(funcInfo.Parameters); obj.Properties.Add(new PSNoteProperty("CommonParameters", common)); - AddDetailsProperties(obj, funcInfo.Name, String.Empty, String.Empty, TypeNameForDefaultHelp); + AddDetailsProperties(obj, funcInfo.Name, string.Empty, string.Empty, TypeNameForDefaultHelp); AddSyntaxProperties(obj, funcInfo.Name, funcInfo.ParameterSets, common, TypeNameForDefaultHelp); AddParametersProperties(obj, funcInfo.Parameters, common, TypeNameForDefaultHelp); AddInputTypesProperties(obj, funcInfo.Parameters); @@ -139,7 +139,7 @@ namespace System.Management.Automation.Help obj.Properties.Add(new PSNoteProperty("examples", null)); obj.Properties.Add(new PSNoteProperty("Synopsis", commandInfo.Syntax)); obj.Properties.Add(new PSNoteProperty("ModuleName", commandInfo.ModuleName)); - obj.Properties.Add(new PSNoteProperty("nonTerminatingErrors", String.Empty)); + obj.Properties.Add(new PSNoteProperty("nonTerminatingErrors", string.Empty)); obj.Properties.Add(new PSNoteProperty("xmlns:command", "http://schemas.microsoft.com/maml/dev/command/2004/10")); obj.Properties.Add(new PSNoteProperty("xmlns:dev", "http://schemas.microsoft.com/maml/dev/2004/10")); obj.Properties.Add(new PSNoteProperty("xmlns:maml", "http://schemas.microsoft.com/maml/2004/10")); @@ -162,7 +162,7 @@ namespace System.Management.Automation.Help PSObject mshObject = new PSObject(); mshObject.TypeNames.Clear(); - mshObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#details", typeNameForHelp)); + mshObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#details", typeNameForHelp)); mshObject.Properties.Add(new PSNoteProperty("name", name)); mshObject.Properties.Add(new PSNoteProperty("noun", noun)); @@ -194,7 +194,7 @@ namespace System.Management.Automation.Help PSObject mshObject = new PSObject(); mshObject.TypeNames.Clear(); - mshObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#syntax", typeNameForHelp)); + mshObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#syntax", typeNameForHelp)); AddSyntaxItemProperties(mshObject, cmdletName, parameterSets, common, typeNameForHelp); @@ -218,7 +218,7 @@ namespace System.Management.Automation.Help PSObject mshObject = new PSObject(); mshObject.TypeNames.Clear(); - mshObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#syntaxItem", typeNameForHelp)); + mshObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#syntaxItem", typeNameForHelp)); mshObject.Properties.Add(new PSNoteProperty("name", cmdletName)); mshObject.Properties.Add(new PSNoteProperty("CommonParameters", common)); @@ -265,7 +265,7 @@ namespace System.Management.Automation.Help PSObject mshObject = new PSObject(); mshObject.TypeNames.Clear(); - mshObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#parameter", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + mshObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#parameter", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); Collection attributes = new Collection(parameter.Attributes); @@ -341,7 +341,7 @@ namespace System.Management.Automation.Help PSObject paramValueGroup = new PSObject(); paramValueGroup.TypeNames.Clear(); - paramValueGroup.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#parameterValueGroup", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + paramValueGroup.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#parameterValueGroup", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); ArrayList paramValue = new ArrayList(values); @@ -361,7 +361,7 @@ namespace System.Management.Automation.Help PSObject paramsObject = new PSObject(); paramsObject.TypeNames.Clear(); - paramsObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#parameters", typeNameForHelp)); + paramsObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#parameters", typeNameForHelp)); ArrayList paramObjects = new ArrayList(); @@ -387,7 +387,7 @@ namespace System.Management.Automation.Help PSObject paramObject = new PSObject(); paramObject.TypeNames.Clear(); - paramObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#parameter", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + paramObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#parameter", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); AddParameterProperties(paramObject, parameter, parameters[parameter].Aliases, parameters[parameter].IsDynamic, parameters[parameter].ParameterType, parameters[parameter].Attributes); @@ -530,7 +530,7 @@ namespace System.Management.Automation.Help PSObject mshObject = new PSObject(); mshObject.TypeNames.Clear(); - mshObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#type", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + mshObject.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#type", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); var parameterTypeString = CommandParameterSetInfo.GetParameterTypeString(parameterType, attributes); mshObject.Properties.Add(new PSNoteProperty("name", parameterTypeString)); @@ -612,17 +612,17 @@ namespace System.Management.Automation.Help PSObject inputTypesObj = new PSObject(); inputTypesObj.TypeNames.Clear(); - inputTypesObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#inputTypes", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + inputTypesObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#inputTypes", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); PSObject inputTypeObj = new PSObject(); inputTypeObj.TypeNames.Clear(); - inputTypeObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#inputType", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + inputTypeObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#inputType", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); PSObject typeObj = new PSObject(); typeObj.TypeNames.Clear(); - typeObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#type", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + typeObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#type", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); typeObj.Properties.Add(new PSNoteProperty("name", sb.ToString())); inputTypeObj.Properties.Add(new PSNoteProperty("type", typeObj)); @@ -640,17 +640,17 @@ namespace System.Management.Automation.Help PSObject returnValuesObj = new PSObject(); returnValuesObj.TypeNames.Clear(); - returnValuesObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#returnValues", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + returnValuesObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#returnValues", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); PSObject returnValueObj = new PSObject(); returnValueObj.TypeNames.Clear(); - returnValueObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#returnValue", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + returnValueObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#returnValue", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); PSObject typeObj = new PSObject(); typeObj.TypeNames.Clear(); - typeObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#type", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + typeObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#type", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); if (outputTypes.Count == 0) { @@ -732,7 +732,7 @@ namespace System.Management.Automation.Help PSObject navigationLinkObj = new PSObject(); navigationLinkObj.TypeNames.Clear(); - navigationLinkObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#navigationLinks", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + navigationLinkObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#navigationLinks", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); navigationLinkObj.Properties.Add(new PSNoteProperty("uri", relatedLink)); @@ -768,7 +768,7 @@ namespace System.Management.Automation.Help PSObject relatedLinksObj = new PSObject(); relatedLinksObj.TypeNames.Clear(); - relatedLinksObj.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#relatedLinks", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); + relatedLinksObj.TypeNames.Add(string.Format(CultureInfo.InvariantCulture, "{0}#relatedLinks", DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp)); relatedLinksObj.Properties.Add(new PSNoteProperty("navigationLink", navigationLinkValues.ToArray())); obj.Properties.Add(new PSNoteProperty("relatedLinks", relatedLinksObj)); diff --git a/src/System.Management.Automation/help/DscResourceHelpProvider.cs b/src/System.Management.Automation/help/DscResourceHelpProvider.cs index 5d79a28bf..08b6fe827 100644 --- a/src/System.Management.Automation/help/DscResourceHelpProvider.cs +++ b/src/System.Management.Automation/help/DscResourceHelpProvider.cs @@ -316,7 +316,7 @@ namespace System.Management.Automation for (int i = 0; i < doc.ChildNodes.Count; i++) { XmlNode node = doc.ChildNodes[i]; - if (node.NodeType == XmlNodeType.Element && String.Compare(node.LocalName, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.LocalName, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) { helpItemsNode = node; break; @@ -342,7 +342,7 @@ namespace System.Management.Automation string nodeLocalName = node.LocalName; - bool isDscResource = (String.Compare(nodeLocalName, "dscResource", StringComparison.OrdinalIgnoreCase) == 0); + bool isDscResource = (string.Compare(nodeLocalName, "dscResource", StringComparison.OrdinalIgnoreCase) == 0); if (node.NodeType == XmlNodeType.Element && isDscResource) { diff --git a/src/System.Management.Automation/help/HelpUtils.cs b/src/System.Management.Automation/help/HelpUtils.cs index b84e7e1cb..1587b7f90 100644 --- a/src/System.Management.Automation/help/HelpUtils.cs +++ b/src/System.Management.Automation/help/HelpUtils.cs @@ -50,7 +50,7 @@ namespace System.Management.Automation //This module is not an inbox module, so help goes under / newModuleBase = Path.Combine(userHelpPath, moduleName); } - else if (String.Equals(moduleBaseParent, moduleName, StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(moduleBaseParent, moduleName, StringComparison.OrdinalIgnoreCase)) { //This module has version folder. var moduleVersion = Path.GetFileName(moduleBase); diff --git a/src/System.Management.Automation/help/MamlNode.cs b/src/System.Management.Automation/help/MamlNode.cs index f5c5d53b3..4bdf345e7 100644 --- a/src/System.Management.Automation/help/MamlNode.cs +++ b/src/System.Management.Automation/help/MamlNode.cs @@ -214,9 +214,9 @@ namespace System.Management.Automation if (xmlNode.Attributes["type"] != null) { - if (String.Compare(xmlNode.Attributes["type"].Value, "field", StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(xmlNode.Attributes["type"].Value, "field", StringComparison.OrdinalIgnoreCase) == 0) mshObject.TypeNames.Add("MamlPSClassHelpInfo#field"); - else if (String.Compare(xmlNode.Attributes["type"].Value, "method", StringComparison.OrdinalIgnoreCase) == 0) + else if (string.Compare(xmlNode.Attributes["type"].Value, "method", StringComparison.OrdinalIgnoreCase) == 0) mshObject.TypeNames.Add("MamlPSClassHelpInfo#method"); } @@ -654,7 +654,7 @@ namespace System.Management.Automation { if (childNode.LocalName.Equals("para", StringComparison.OrdinalIgnoreCase)) { - if (childNode.InnerText.Trim().Equals(String.Empty)) + if (childNode.InnerText.Trim().Equals(string.Empty)) { continue; } @@ -758,7 +758,7 @@ namespace System.Management.Automation StringBuilder sb = new StringBuilder(); - if (newLine && !xmlNode.InnerText.Trim().Equals(String.Empty)) + if (newLine && !xmlNode.InnerText.Trim().Equals(string.Empty)) { sb.AppendLine(xmlNode.InnerText.Trim()); } diff --git a/src/System.Management.Automation/help/PSClassHelpProvider.cs b/src/System.Management.Automation/help/PSClassHelpProvider.cs index d1af0a544..2fff24b1e 100644 --- a/src/System.Management.Automation/help/PSClassHelpProvider.cs +++ b/src/System.Management.Automation/help/PSClassHelpProvider.cs @@ -321,7 +321,7 @@ namespace System.Management.Automation for (int i = 0; i < doc.ChildNodes.Count; i++) { XmlNode node = doc.ChildNodes[i]; - if (node.NodeType == XmlNodeType.Element && String.Compare(node.LocalName, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.LocalName, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) { helpItemsNode = node; break; @@ -347,7 +347,7 @@ namespace System.Management.Automation string nodeLocalName = node.LocalName; - bool isClass = (String.Compare(nodeLocalName, "class", StringComparison.OrdinalIgnoreCase) == 0); + bool isClass = (string.Compare(nodeLocalName, "class", StringComparison.OrdinalIgnoreCase) == 0); if (node.NodeType == XmlNodeType.Element && isClass) { diff --git a/src/System.Management.Automation/help/ProviderHelpProvider.cs b/src/System.Management.Automation/help/ProviderHelpProvider.cs index 2a94f2b3b..699892ad3 100644 --- a/src/System.Management.Automation/help/ProviderHelpProvider.cs +++ b/src/System.Management.Automation/help/ProviderHelpProvider.cs @@ -209,7 +209,7 @@ namespace System.Management.Automation for (int i = 0; i < doc.ChildNodes.Count; i++) { XmlNode node = doc.ChildNodes[i]; - if (node.NodeType == XmlNodeType.Element && String.Compare(node.Name, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.Name, "helpItems", StringComparison.OrdinalIgnoreCase) == 0) { helpItemsNode = node; break; @@ -227,7 +227,7 @@ namespace System.Management.Automation for (int i = 0; i < helpItemsNode.ChildNodes.Count; i++) { XmlNode node = helpItemsNode.ChildNodes[i]; - if (node.NodeType == XmlNodeType.Element && String.Compare(node.Name, "providerHelp", StringComparison.OrdinalIgnoreCase) == 0) + if (node.NodeType == XmlNodeType.Element && string.Compare(node.Name, "providerHelp", StringComparison.OrdinalIgnoreCase) == 0) { HelpInfo helpInfo = ProviderHelpInfo.Load(node); diff --git a/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs b/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs index dcc4cb417..2b85bdbb7 100644 --- a/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs +++ b/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs @@ -373,7 +373,7 @@ namespace Microsoft.PowerShell.Commands // multiple cultures or multiple modules are involved. e = new UpdatableHelpExceptionContext(new UpdatableHelpSystemException( "HelpCultureNotSupported", StringUtil.Format(HelpDisplayStrings.CannotMatchUICulturePattern, - String.Join(", ", exception.Cultures)), + string.Join(", ", exception.Cultures)), ErrorCategory.InvalidArgument, exception.Cultures, null)); e.Modules = exception.Modules; e.Cultures = exception.Cultures; diff --git a/src/System.Management.Automation/help/UpdatableHelpInfo.cs b/src/System.Management.Automation/help/UpdatableHelpInfo.cs index b36f2cf3d..fc9183515 100644 --- a/src/System.Management.Automation/help/UpdatableHelpInfo.cs +++ b/src/System.Management.Automation/help/UpdatableHelpInfo.cs @@ -107,7 +107,7 @@ namespace System.Management.Automation.Help foreach (CultureSpecificUpdatableHelp updatableHelpItem in UpdatableHelpItems) { - if (String.Compare(updatableHelpItem.Culture.Name, culture.Name, + if (string.Compare(updatableHelpItem.Culture.Name, culture.Name, StringComparison.OrdinalIgnoreCase) == 0) { return true; @@ -152,7 +152,7 @@ namespace System.Management.Automation.Help { foreach (CultureSpecificUpdatableHelp updatableHelpItem in UpdatableHelpItems) { - if (String.Compare(updatableHelpItem.Culture.Name, culture.Name, + if (string.Compare(updatableHelpItem.Culture.Name, culture.Name, StringComparison.OrdinalIgnoreCase) == 0) { return updatableHelpItem.Version; diff --git a/src/System.Management.Automation/help/UpdatableHelpSystem.cs b/src/System.Management.Automation/help/UpdatableHelpSystem.cs index 3e6e5166f..0d6dcfe90 100644 --- a/src/System.Management.Automation/help/UpdatableHelpSystem.cs +++ b/src/System.Management.Automation/help/UpdatableHelpSystem.cs @@ -129,8 +129,8 @@ namespace System.Management.Automation.Help string message = string.Empty; SortedSet sortedModules = new SortedSet(Modules, StringComparer.CurrentCultureIgnoreCase); SortedSet sortedCultures = new SortedSet(Cultures, StringComparer.CurrentCultureIgnoreCase); - string modules = String.Join(", ", sortedModules); - string cultures = String.Join(", ", sortedCultures); + string modules = string.Join(", ", sortedModules); + string cultures = string.Join(", ", sortedCultures); if (commandType == UpdatableHelpCommandType.UpdateHelpCommand) { @@ -1231,8 +1231,8 @@ namespace System.Management.Automation.Help // We only accept txt files and xml files foreach (string file in Directory.GetFiles(sourcePath)) { - if (!String.Equals(Path.GetExtension(file), ".xml", StringComparison.OrdinalIgnoreCase) - && !String.Equals(Path.GetExtension(file), ".txt", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(Path.GetExtension(file), ".xml", StringComparison.OrdinalIgnoreCase) + && !string.Equals(Path.GetExtension(file), ".txt", StringComparison.OrdinalIgnoreCase)) { throw new UpdatableHelpSystemException("HelpContentContainsInvalidFiles", StringUtil.Format(HelpDisplayStrings.HelpContentContainsInvalidFiles), ErrorCategory.InvalidData, @@ -1243,7 +1243,7 @@ namespace System.Management.Automation.Help // xml validation foreach (string file in Directory.GetFiles(sourcePath)) { - if (String.Equals(Path.GetExtension(file), ".xml", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(Path.GetExtension(file), ".xml", StringComparison.OrdinalIgnoreCase)) { if (xsd == null) { @@ -1342,7 +1342,7 @@ namespace System.Management.Automation.Help } } } - else if (String.Equals(Path.GetExtension(file), ".txt", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(Path.GetExtension(file), ".txt", StringComparison.OrdinalIgnoreCase)) { FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read); @@ -1675,7 +1675,7 @@ namespace System.Management.Automation.Help } mappedDrive = new PSDriveInfo(_driveName, cmdlet.SessionState.Internal.GetSingleProvider("FileSystem"), - path, String.Empty, credential); + path, string.Empty, credential); cmdlet.SessionState.Drive.New(mappedDrive, "local"); diff --git a/src/System.Management.Automation/logging/LogProvider.cs b/src/System.Management.Automation/logging/LogProvider.cs index 4f74f2aa8..2187d5f5a 100644 --- a/src/System.Management.Automation/logging/LogProvider.cs +++ b/src/System.Management.Automation/logging/LogProvider.cs @@ -147,14 +147,14 @@ namespace System.Management.Automation { if (context == null) { - return String.Empty; + return string.Empty; } object logData = context.GetVariableValue(SpecialVariables.PSLogUserDataPath); if (logData == null) { - return String.Empty; + return string.Empty; } return logData.ToString(); diff --git a/src/System.Management.Automation/logging/MshLog.cs b/src/System.Management.Automation/logging/MshLog.cs index 6ca46c5c7..2ee75e13c 100644 --- a/src/System.Management.Automation/logging/MshLog.cs +++ b/src/System.Management.Automation/logging/MshLog.cs @@ -775,7 +775,7 @@ namespace System.Management.Automation logContext.HostId = (string)executionContext.EngineHostInterface.InstanceId.ToString(); } - logContext.HostApplication = String.Join(" ", Environment.GetCommandLineArgs()); + logContext.HostApplication = string.Join(" ", Environment.GetCommandLineArgs()); if (executionContext.CurrentRunspace != null) { diff --git a/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs b/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs index 7750555f8..7b699e681 100644 --- a/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs +++ b/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs @@ -66,7 +66,7 @@ namespace System.Management.Automation return source; } - string message = String.Format(Thread.CurrentThread.CurrentCulture, "Event source '{0}' is not registered", source); + string message = string.Format(Thread.CurrentThread.CurrentCulture, "Event source '{0}' is not registered", source); throw new InvalidOperationException(message); } diff --git a/src/System.Management.Automation/namespaces/AliasProvider.cs b/src/System.Management.Automation/namespaces/AliasProvider.cs index 7835193f5..2d745b885 100644 --- a/src/System.Management.Automation/namespaces/AliasProvider.cs +++ b/src/System.Management.Automation/namespaces/AliasProvider.cs @@ -56,7 +56,7 @@ namespace Microsoft.PowerShell.Commands new PSDriveInfo( DriveNames.AliasDrive, ProviderInfo, - String.Empty, + string.Empty, description, null); diff --git a/src/System.Management.Automation/namespaces/EnvironmentProvider.cs b/src/System.Management.Automation/namespaces/EnvironmentProvider.cs index b19f21beb..9b0b1e604 100644 --- a/src/System.Management.Automation/namespaces/EnvironmentProvider.cs +++ b/src/System.Management.Automation/namespaces/EnvironmentProvider.cs @@ -52,7 +52,7 @@ namespace Microsoft.PowerShell.Commands new PSDriveInfo( DriveNames.EnvironmentDrive, ProviderInfo, - String.Empty, + string.Empty, description, null); diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index a78314459..5e06df53d 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -258,12 +258,12 @@ namespace Microsoft.PowerShell.Commands } else { - return String.Empty; + return string.Empty; } if (string.IsNullOrEmpty(verb) || string.IsNullOrEmpty(noun)) { - return String.Empty; + return string.Empty; } // Load the help file from the current UI culture subfolder @@ -285,7 +285,7 @@ namespace Microsoft.PowerShell.Commands nsMgr.AddNamespace("command", HelpCommentsParser.commandURI); // Compose XPath query to select the appropriate node based on the cmdlet - string xpathQuery = String.Format( + string xpathQuery = string.Format( CultureInfo.InvariantCulture, HelpCommentsParser.ProviderHelpCommandXPath, "[@id='FileSystem']", @@ -301,31 +301,31 @@ namespace Microsoft.PowerShell.Commands } catch (XmlException) { - return String.Empty; + return string.Empty; } catch (PathTooLongException) { - return String.Empty; + return string.Empty; } catch (IOException) { - return String.Empty; + return string.Empty; } catch (UnauthorizedAccessException) { - return String.Empty; + return string.Empty; } catch (NotSupportedException) { - return String.Empty; + return string.Empty; } catch (SecurityException) { - return String.Empty; + return string.Empty; } catch (XPathException) { - return String.Empty; + return string.Empty; } finally { @@ -335,7 +335,7 @@ namespace Microsoft.PowerShell.Commands } } - return String.Empty; + return string.Empty; } #endregion @@ -880,7 +880,7 @@ namespace Microsoft.PowerShell.Commands { string newDriveName = newDrive.Name.Substring(0, 1); - string description = String.Empty; + string description = string.Empty; string root = newDrive.Name; string displayRoot = null; @@ -1261,7 +1261,7 @@ namespace Microsoft.PowerShell.Commands // Since all root paths are hidden we need to show the directory // anyway bool isRootPath = - String.Compare( + string.Compare( Path.GetPathRoot(path), result.FullName, StringComparison.OrdinalIgnoreCase) == 0; @@ -1836,11 +1836,11 @@ namespace Microsoft.PowerShell.Commands public static string Mode(PSObject instance) { if (instance == null) - return String.Empty; + return string.Empty; FileSystemInfo fileInfo = (FileSystemInfo)instance.BaseObject; if (fileInfo == null) - return String.Empty; + return string.Empty; char[] mode = new char[6]; mode[0] = (fileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory ? 'd' : '-'; @@ -1903,14 +1903,14 @@ namespace Microsoft.PowerShell.Commands { newName = newName.Remove(0, 2); } - else if (String.Equals(Path.GetDirectoryName(path), Path.GetDirectoryName(newName), StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(Path.GetDirectoryName(path), Path.GetDirectoryName(newName), StringComparison.OrdinalIgnoreCase)) { newName = Path.GetFileName(newName); } //Check to see if the target specified is just filename. We dont allow rename to move the file to a different directory. //If a path is specified for the newName then we flag that as an error. - if (String.Compare(Path.GetFileName(newName), newName, StringComparison.OrdinalIgnoreCase) != 0) + if (string.Compare(Path.GetFileName(newName), newName, StringComparison.OrdinalIgnoreCase) != 0) { throw PSTraceSource.NewArgumentException("newName", FileSystemProviderStrings.RenameError); } @@ -2594,7 +2594,7 @@ namespace Microsoft.PowerShell.Commands do { - string root = String.Empty; + string root = string.Empty; if (PSDriveInfo != null) { @@ -2604,7 +2604,7 @@ namespace Microsoft.PowerShell.Commands string parentPath = GetParentPath(path, root); if (!string.IsNullOrEmpty(parentPath) && - String.Compare( + string.Compare( parentPath, previousParent, StringComparison.OrdinalIgnoreCase) != 0) @@ -2751,7 +2751,7 @@ namespace Microsoft.PowerShell.Commands foundStream = true; - string action = String.Format( + string action = string.Format( CultureInfo.InvariantCulture, FileSystemProviderStrings.StreamAction, stream.Stream, fsinfo.FullName); @@ -3430,7 +3430,7 @@ namespace Microsoft.PowerShell.Commands Hashtable op = SafeInvokeCommand.Invoke(ps, this, null); if (op == null) { - Exception e = new IOException(String.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailedToReadFile, path)); + Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailedToReadFile, path)); WriteError(new ErrorRecord(e, "CopyItemRemotelyFailedToReadFile", ErrorCategory.WriteError, path)); return; } @@ -3456,7 +3456,7 @@ namespace Microsoft.PowerShell.Commands { if (File.Exists(destinationPath)) { - Exception e = new IOException(String.Format( + Exception e = new IOException(string.Format( CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyDestinationIsFile, path, @@ -3578,7 +3578,7 @@ namespace Microsoft.PowerShell.Commands // Verify that the destination is not a file on the remote end if (RemoteDestinationPathIsFile(destination, ps)) { - Exception e = new IOException(String.Format(CultureInfo.InvariantCulture, + Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemoteDestinationIsFile, destination)); WriteError(new ErrorRecord(e, "CopyError", ErrorCategory.WriteError, destination)); @@ -3829,7 +3829,7 @@ namespace Microsoft.PowerShell.Commands Hashtable op = SafeInvokeCommand.Invoke(ps, this, null); if (op == null) { - Exception e = new IOException(String.Format( + Exception e = new IOException(string.Format( CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailedToGetDirectoryChildItems, sourceDirectoryFullName)); @@ -3990,19 +3990,19 @@ namespace Microsoft.PowerShell.Commands PSObject obj = (PSObject)metadata["Attributes"]; foreach (string value in (ArrayList)obj.BaseObject) { - if (String.Equals(value, "ReadOnly", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(value, "ReadOnly", StringComparison.OrdinalIgnoreCase)) { destinationFile.Attributes = destinationFile.Attributes | FileAttributes.ReadOnly; } - else if (String.Equals(value, "Hidden", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(value, "Hidden", StringComparison.OrdinalIgnoreCase)) { destinationFile.Attributes = destinationFile.Attributes | FileAttributes.Hidden; } - else if (String.Equals(value, "Archive", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(value, "Archive", StringComparison.OrdinalIgnoreCase)) { destinationFile.Attributes = destinationFile.Attributes | FileAttributes.Archive; } - else if (String.Equals(value, "System", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(value, "System", StringComparison.OrdinalIgnoreCase)) { destinationFile.Attributes = destinationFile.Attributes | FileAttributes.System; } @@ -4073,11 +4073,11 @@ namespace Microsoft.PowerShell.Commands long fileSize, bool isAlternateDataStream, string streamName) { bool success = false; - string activity = String.Format(CultureInfo.InvariantCulture, + string activity = string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyProgressActivity, sourceFileFullName, destinationFile.FullName); - string statusDescription = String.Format(CultureInfo.InvariantCulture, + string statusDescription = string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyStatusDescription, ps.Runspace.ConnectionInfo.ComputerName, "localhost"); @@ -4139,7 +4139,7 @@ namespace Microsoft.PowerShell.Commands if (op == null) { errorWhileCopyRemoteFile = true; - Exception e = new IOException(String.Format(CultureInfo.InvariantCulture, + Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailedToReadFile, sourceFileFullName)); WriteError(new ErrorRecord(e, "FailedToCopyFileFromRemoteSession", ErrorCategory.WriteError, sourceFileFullName)); @@ -4347,11 +4347,11 @@ namespace Microsoft.PowerShell.Commands private bool CopyFileStreamToRemoteSession(FileInfo file, string destinationPath, System.Management.Automation.PowerShell ps, bool isAlternateStream, string streamName) { - string activity = String.Format(CultureInfo.InvariantCulture, + string activity = string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyProgressActivity, file.FullName, destinationPath); - string statusDescription = String.Format(CultureInfo.InvariantCulture, + string statusDescription = string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyStatusDescription, "localhost", ps.Runspace.ConnectionInfo.ComputerName); @@ -4452,14 +4452,14 @@ namespace Microsoft.PowerShell.Commands if (op == null || op["BytesWritten"] == null) { //write error to stream - Exception e = new IOException(String.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailed, file)); + Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailed, file)); WriteError(new ErrorRecord(e, "CopyError", ErrorCategory.WriteError, file.FullName)); return false; } if ((int)(op["BytesWritten"]) != toRead) { - Exception e = new IOException(String.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailed, file)); + Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailed, file)); WriteError(new ErrorRecord(e, "CopyError", ErrorCategory.WriteError, file.FullName)); return false; } @@ -4539,7 +4539,7 @@ namespace Microsoft.PowerShell.Commands if (string.IsNullOrEmpty(remoteFilePath)) { - Exception e = new ArgumentException(String.Format(CultureInfo.InvariantCulture, SessionStateStrings.PathNotFound, destinationPath)); + Exception e = new ArgumentException(string.Format(CultureInfo.InvariantCulture, SessionStateStrings.PathNotFound, destinationPath)); WriteError(new ErrorRecord(e, "RemotePathNotFound", ErrorCategory.WriteError, destinationPath)); return false; } @@ -4554,7 +4554,7 @@ namespace Microsoft.PowerShell.Commands { foreach (AlternateStreamData stream in AlternateDataStreamUtilities.GetStreams(file.FullName)) { - if (!(String.Equals(":$DATA", stream.Stream, StringComparison.OrdinalIgnoreCase))) + if (!(string.Equals(":$DATA", stream.Stream, StringComparison.OrdinalIgnoreCase))) { result = CopyFileStreamToRemoteSession(file, remoteFilePath, ps, true, stream.Stream); if (!result) @@ -4582,7 +4582,7 @@ namespace Microsoft.PowerShell.Commands if (op == null || op["IsFileInfo"] == null) { - Exception e = new IOException(String.Format( + Exception e = new IOException(string.Format( CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailedToValidateIfDestinationIsFile, destination)); @@ -4614,7 +4614,7 @@ namespace Microsoft.PowerShell.Commands if (force && (op["DirectoryPath"] == null)) { - Exception e = new IOException(String.Format(CultureInfo.InvariantCulture, + Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailedToCreateDirectory, destination)); WriteError(new ErrorRecord(e, "FailedToCreateDirectory", ErrorCategory.WriteError, destination)); @@ -4781,7 +4781,7 @@ namespace Microsoft.PowerShell.Commands return false; } - bool isDriveRoot = String.Equals(path, Path.GetPathRoot(path), StringComparison.OrdinalIgnoreCase); + bool isDriveRoot = string.Equals(path, Path.GetPathRoot(path), StringComparison.OrdinalIgnoreCase); bool isUNCRoot = IsUNCRoot(path); bool result = isDriveRoot || isUNCRoot; s_tracer.WriteLine("result = {0}; isDriveRoot = {1}; isUNCRoot = {2}", result, isDriveRoot, isUNCRoot); @@ -4816,7 +4816,7 @@ namespace Microsoft.PowerShell.Commands if (basePath == null) { - basePath = String.Empty; + basePath = string.Empty; } s_tracer.WriteLine("basePath = {0}", basePath); @@ -4876,11 +4876,11 @@ namespace Microsoft.PowerShell.Commands // Now ensure that we have the proper casing by // getting the names of the files and directories that match - string directoryPath = GetParentPath(result, String.Empty); + string directoryPath = GetParentPath(result, string.Empty); if (string.IsNullOrEmpty(directoryPath)) { - return String.Empty; + return string.Empty; } #if UNIX @@ -5006,12 +5006,12 @@ namespace Microsoft.PowerShell.Commands if (path.Length == 0) { - return String.Empty; + return string.Empty; } if (basePath == null) { - basePath = String.Empty; + basePath = string.Empty; } s_tracer.WriteLine("basePath = {0}", basePath); @@ -5019,7 +5019,7 @@ namespace Microsoft.PowerShell.Commands #if !UNIX // Remove alternate data stream references // See if they've used the inline stream syntax. They have more than one colon. - string alternateDataStream = String.Empty; + string alternateDataStream = string.Empty; int firstColon = path.IndexOf(':'); int secondColon = path.IndexOf(':', firstColon + 1); if (secondColon > 0) @@ -5046,7 +5046,7 @@ namespace Microsoft.PowerShell.Commands // See if the base and the path are already the same. We resolve this to // ..\Leaf, since resolving "." to "." doesn't offer much information. - if (String.Equals(path, basePath, StringComparison.OrdinalIgnoreCase) && + if (string.Equals(path, basePath, StringComparison.OrdinalIgnoreCase) && (!originalPath.EndsWith(StringLiterals.DefaultPathSeparator))) { string childName = GetChildName(path); @@ -5066,7 +5066,7 @@ namespace Microsoft.PowerShell.Commands (!string.IsNullOrEmpty(basePath)) ) { - result = String.Empty; + result = string.Empty; string commonBase = GetCommonBase(path, basePath); Stack parentNavigationStack = TokenizePathToStack(basePath, commonBase); @@ -5093,7 +5093,7 @@ namespace Microsoft.PowerShell.Commands // instead of ".." as would usually be returned if (!string.IsNullOrEmpty(commonBase)) { - if (String.Equals(path, commonBase, StringComparison.OrdinalIgnoreCase) && + if (string.Equals(path, commonBase, StringComparison.OrdinalIgnoreCase) && (!path.EndsWith(StringLiterals.DefaultPathSeparator))) { string childName = GetChildName(path); @@ -5125,7 +5125,7 @@ namespace Microsoft.PowerShell.Commands } else { - result = String.Empty; + result = string.Empty; break; } } @@ -5200,7 +5200,7 @@ namespace Microsoft.PowerShell.Commands // longer path. If it is not, take the child off of the longer // path and compare again. - while (!String.Equals(path1, path2, StringComparison.OrdinalIgnoreCase)) + while (!string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase)) { if (path2.Length > path1.Length) { @@ -5392,7 +5392,7 @@ namespace Microsoft.PowerShell.Commands /// private string CreateNormalizedRelativePathFromStack(Stack normalizedPathStack) { - string leafElement = String.Empty; + string leafElement = string.Empty; while (normalizedPathStack.Count > 0) { @@ -6092,7 +6092,7 @@ namespace Microsoft.PowerShell.Commands } string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -6253,7 +6253,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = FileSystemProviderStrings.ClearPropertyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, fileSystemInfo.FullName, @@ -6692,7 +6692,7 @@ namespace Microsoft.PowerShell.Commands // If they're just working on the DATA stream, don't use the Alternate Data Stream // utils to clear the stream - otherwise, the Win32 API will trash the other streams. - if (String.Equals(":$DATA", streamName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(":$DATA", streamName, StringComparison.OrdinalIgnoreCase)) { clearStream = false; } @@ -6701,7 +6701,7 @@ namespace Microsoft.PowerShell.Commands { FileStream fileStream = null; - string streamAction = String.Format( + string streamAction = string.Format( CultureInfo.InvariantCulture, FileSystemProviderStrings.StreamAction, streamName, path); @@ -7755,7 +7755,7 @@ namespace Microsoft.PowerShell.Commands //Don't add the target link to the list. - if (String.Compare(fInfo.FullName, filePath, StringComparison.OrdinalIgnoreCase) != 0) + if (string.Compare(fInfo.FullName, filePath, StringComparison.OrdinalIgnoreCase) != 0) links.Add(fInfo.FullName); continueFind = InternalSymbolicLinkLinkCodeMethods.FindNextFileName(fileHandle, ref linkStringLength, linkName); @@ -8253,7 +8253,7 @@ namespace System.Management.Automation.Internal // And trailing :$DATA (as long as it's not the default data stream) string dataStream = ":$DATA"; - if (!String.Equals(findStreamData.Name, dataStream, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(findStreamData.Name, dataStream, StringComparison.OrdinalIgnoreCase)) { findStreamData.Name = findStreamData.Name.Replace(dataStream, string.Empty); } diff --git a/src/System.Management.Automation/namespaces/FunctionProvider.cs b/src/System.Management.Automation/namespaces/FunctionProvider.cs index 3ad565e14..48de16328 100644 --- a/src/System.Management.Automation/namespaces/FunctionProvider.cs +++ b/src/System.Management.Automation/namespaces/FunctionProvider.cs @@ -57,7 +57,7 @@ namespace Microsoft.PowerShell.Commands new PSDriveInfo( DriveNames.FunctionDrive, ProviderInfo, - String.Empty, + string.Empty, description, null); diff --git a/src/System.Management.Automation/namespaces/LocationGlobber.cs b/src/System.Management.Automation/namespaces/LocationGlobber.cs index e8a6b07bf..18a0f0e0b 100644 --- a/src/System.Management.Automation/namespaces/LocationGlobber.cs +++ b/src/System.Management.Automation/namespaces/LocationGlobber.cs @@ -407,7 +407,7 @@ namespace System.Management.Automation else { constructedProviderPath = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}::{1}", providerId, @@ -1718,7 +1718,7 @@ namespace System.Management.Automation bool result = false; - if (String.Compare( + if (string.Compare( driveName, StringLiterals.Global, StringComparison.OrdinalIgnoreCase) == 0) @@ -1728,7 +1728,7 @@ namespace System.Management.Automation result = true; scope = _sessionState.Internal.GlobalScope; } - else if (String.Compare( + else if (string.Compare( driveName, StringLiterals.Local, StringComparison.OrdinalIgnoreCase) == 0) @@ -1928,7 +1928,7 @@ namespace System.Management.Automation // have access to it. context.Drive = workingDriveForPath; - string relativePath = String.Empty; + string relativePath = string.Empty; relativePath = GenerateRelativePath( @@ -2098,7 +2098,7 @@ namespace System.Management.Automation // is that for file paths a path that is already relative to the drive // root is the same thing as an absolute path (both start with /). - driveRootRelativeWorkingPath = String.Empty; + driveRootRelativeWorkingPath = string.Empty; // Remove the \ or / from the drive relative // path @@ -2200,7 +2200,7 @@ namespace System.Management.Automation if (path.Equals(currentDirSymbol, StringComparison.OrdinalIgnoreCase)) { processedSomething = true; - path = String.Empty; + path = string.Empty; break; } @@ -2714,7 +2714,7 @@ namespace System.Management.Automation string newParentPath = navigationProvider.GetParentPath(path, drive.Root, context); - if (String.Equals( + if (string.Equals( newParentPath, path, StringComparison.OrdinalIgnoreCase)) @@ -2741,7 +2741,7 @@ namespace System.Management.Automation // it can have only one segment in its path. So after removing // the leaf all we have left is the empty string. - path = String.Empty; + path = string.Empty; } s_tracer.WriteLine("New path: {0}", path); @@ -2770,7 +2770,7 @@ namespace System.Management.Automation } else { - path = String.Empty; + path = string.Empty; } leafElements.Push(leafElement); @@ -2921,7 +2921,7 @@ namespace System.Management.Automation } string resolvedPath = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, formatString, drive.Name, @@ -3087,7 +3087,7 @@ namespace System.Management.Automation else { string possibleDriveName = path.Substring(0, index); - if (String.Equals(possibleDriveName, drive.Name, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(possibleDriveName, drive.Name, StringComparison.OrdinalIgnoreCase)) { treatAsRelative = false; } @@ -3130,7 +3130,7 @@ namespace System.Management.Automation } result = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, formatString, drive.Name, @@ -3231,7 +3231,7 @@ namespace System.Management.Automation if (!pathResolved) { result = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}{1}{2}", provider.FullName, @@ -3399,7 +3399,7 @@ namespace System.Management.Automation // Now continue on with the names that were returned - string mshQualifiedParentPath = String.Empty; + string mshQualifiedParentPath = string.Empty; Collection childNamesObjectArray = GetChildNamesInDir( dir, @@ -3428,7 +3428,7 @@ namespace System.Management.Automation throw new PipelineStoppedException(); } - string child = String.Empty; + string child = string.Empty; if (IsChildNameAMatch( childObject, @@ -3671,7 +3671,7 @@ namespace System.Management.Automation { // See if we can get the root from the context - string root = String.Empty; + string root = string.Empty; if (context != null) { @@ -3687,7 +3687,7 @@ namespace System.Management.Automation string newParentPath = navigationProvider.GetParentPath(path, root, context); - if (String.Equals( + if (string.Equals( newParentPath, path, StringComparison.OrdinalIgnoreCase)) @@ -3714,7 +3714,7 @@ namespace System.Management.Automation // it can have only one segment in its path. So after removing // the leaf all we have left is the empty string. - path = String.Empty; + path = string.Empty; } s_tracer.WriteLine("New path: {0}", path); @@ -3742,7 +3742,7 @@ namespace System.Management.Automation } else { - path = String.Empty; + path = string.Empty; } leafElements.Push(leafElement); @@ -4026,7 +4026,7 @@ namespace System.Management.Automation throw new PipelineStoppedException(); } - string child = String.Empty; + string child = string.Empty; if (IsChildNameAMatch(childObject, stringMatcher, includeMatcher, excludeMatcher, out child)) { string childPath = child; @@ -4698,7 +4698,7 @@ namespace System.Management.Automation if ((s_pathResolutionTracer.Options & PSTraceSourceOptions.WriteLine) != 0) { // Trace the filter - s_pathResolutionTracer.WriteLine("Filter: {0}", context.Filter ?? String.Empty); + s_pathResolutionTracer.WriteLine("Filter: {0}", context.Filter ?? string.Empty); if (context.Include != null) { diff --git a/src/System.Management.Automation/namespaces/NavigationProviderBase.cs b/src/System.Management.Automation/namespaces/NavigationProviderBase.cs index 306ffba67..e07422f7c 100644 --- a/src/System.Management.Automation/namespaces/NavigationProviderBase.cs +++ b/src/System.Management.Automation/namespaces/NavigationProviderBase.cs @@ -327,7 +327,7 @@ namespace System.Management.Automation.Provider { // If both are empty, just return the empty string. - result = String.Empty; + result = string.Empty; } else if (string.IsNullOrEmpty(parent) && !string.IsNullOrEmpty(child)) @@ -466,7 +466,7 @@ namespace System.Management.Automation.Provider path = NormalizePath(path); path = path.TrimEnd(StringLiterals.DefaultPathSeparator); - string rootPath = String.Empty; + string rootPath = string.Empty; if (root != null) { @@ -476,12 +476,12 @@ namespace System.Management.Automation.Provider // Check to see if the path is equal to the root // of the virtual drive - if (String.Compare( + if (string.Compare( path, rootPath, StringComparison.OrdinalIgnoreCase) == 0) { - parentPath = String.Empty; + parentPath = string.Empty; } else { @@ -499,7 +499,7 @@ namespace System.Management.Automation.Provider } else { - parentPath = String.Empty; + parentPath = string.Empty; } } @@ -557,12 +557,12 @@ namespace System.Management.Automation.Provider if (path.Length == 0) { - return String.Empty; + return string.Empty; } if (basePath == null) { - basePath = String.Empty; + basePath = string.Empty; } providerBaseTracer.WriteLine("basePath = {0}", basePath); @@ -587,7 +587,7 @@ namespace System.Management.Automation.Provider // Active Directory team. // // WORKAROUND WORKAROUND WORKAROUND WORKAROUND WORKAROUND WORKAROUND WORKAROUND WORKAROUND WORKAROUND - if (!String.Equals(context.ProviderInstance.ProviderInfo.FullName, + if (!string.Equals(context.ProviderInstance.ProviderInfo.FullName, @"Microsoft.ActiveDirectory.Management\ActiveDirectory", StringComparison.OrdinalIgnoreCase)) { normalizedPath = NormalizePath(path); @@ -610,7 +610,7 @@ namespace System.Management.Automation.Provider // See if the base and the path are already the same. We resolve this to // ..\Leaf, since resolving "." to "." doesn't offer much information. - if (String.Equals(normalizedPath, normalizedBasePath, StringComparison.OrdinalIgnoreCase) && + if (string.Equals(normalizedPath, normalizedBasePath, StringComparison.OrdinalIgnoreCase) && (!originalPath.EndsWith(StringLiterals.DefaultPathSeparator))) { string childName = GetChildName(path); @@ -623,7 +623,7 @@ namespace System.Management.Automation.Provider if (!normalizedPath.StartsWith(normalizedBasePath, StringComparison.OrdinalIgnoreCase) && (basePath.Length > 0)) { - result = String.Empty; + result = string.Empty; string commonBase = GetCommonBase(normalizedPath, normalizedBasePath); Stack parentNavigationStack = TokenizePathToStack(normalizedBasePath, commonBase); @@ -650,7 +650,7 @@ namespace System.Management.Automation.Provider // instead of ".." as would usually be returned if (!string.IsNullOrEmpty(commonBase)) { - if (String.Equals(normalizedPath, commonBase, StringComparison.OrdinalIgnoreCase) && + if (string.Equals(normalizedPath, commonBase, StringComparison.OrdinalIgnoreCase) && (!normalizedPath.EndsWith(StringLiterals.DefaultPathSeparator))) { string childName = GetChildName(path); @@ -712,7 +712,7 @@ namespace System.Management.Automation.Provider // longer path. If it is not, take the child off of the longer // path and compare again. - while (!String.Equals(path1, path2, StringComparison.OrdinalIgnoreCase)) + while (!string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase)) { if (path2.Length > path1.Length) { @@ -1100,7 +1100,7 @@ namespace System.Management.Automation.Provider /// private string CreateNormalizedRelativePathFromStack(Stack normalizedPathStack) { - string leafElement = String.Empty; + string leafElement = string.Empty; while (normalizedPathStack.Count > 0) { diff --git a/src/System.Management.Automation/namespaces/PathInfo.cs b/src/System.Management.Automation/namespaces/PathInfo.cs index 510dddb92..fb1834227 100644 --- a/src/System.Management.Automation/namespaces/PathInfo.cs +++ b/src/System.Management.Automation/namespaces/PathInfo.cs @@ -93,7 +93,7 @@ namespace System.Management.Automation private PSDriveInfo _drive; private ProviderInfo _provider; - private string _path = String.Empty; + private string _path = string.Empty; /// /// Gets a string representing the MSH path. diff --git a/src/System.Management.Automation/namespaces/ProviderBase.cs b/src/System.Management.Automation/namespaces/ProviderBase.cs index c15a6bb09..53873d837 100644 --- a/src/System.Management.Automation/namespaces/ProviderBase.cs +++ b/src/System.Management.Automation/namespaces/ProviderBase.cs @@ -1826,10 +1826,10 @@ namespace System.Management.Automation.Provider } else { - parentPath = navProvider.GetParentPath(path, String.Empty, Context); + parentPath = navProvider.GetParentPath(path, string.Empty, Context); } - string providerQualifiedParentPath = String.Empty; + string providerQualifiedParentPath = string.Empty; if (!string.IsNullOrEmpty(parentPath)) { diff --git a/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs b/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs index a302516ea..2ab25b3fb 100644 --- a/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs +++ b/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs @@ -57,7 +57,7 @@ namespace System.Management.Automation.Provider /// /// Gets the name of the provider. /// - public string ProviderName { get; } = String.Empty; + public string ProviderName { get; } = string.Empty; /// /// Gets the flags that represent the capabilities of the provider. diff --git a/src/System.Management.Automation/namespaces/RegistryProvider.cs b/src/System.Management.Automation/namespaces/RegistryProvider.cs index 6fe215ae9..34f92221c 100644 --- a/src/System.Management.Automation/namespaces/RegistryProvider.cs +++ b/src/System.Management.Automation/namespaces/RegistryProvider.cs @@ -250,7 +250,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.SetItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -414,7 +414,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.ClearItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path); @@ -897,7 +897,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.RenameItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -942,7 +942,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.NewItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path); @@ -1013,7 +1013,7 @@ namespace Microsoft.PowerShell.Commands return; } - SetRegistryValue(newKey, String.Empty, newItem, kind, path, false); + SetRegistryValue(newKey, string.Empty, newItem, kind, path, false); } } catch (Exception exception) @@ -1117,7 +1117,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.RemoveKeyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path); @@ -1404,7 +1404,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.CopyKeyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -1512,7 +1512,7 @@ namespace Microsoft.PowerShell.Commands { // See if the paths are equal - if (String.Compare( + if (string.Compare( sourcePath, destinationPath, StringComparison.OrdinalIgnoreCase) == 0) @@ -1530,7 +1530,7 @@ namespace Microsoft.PowerShell.Commands break; } - if (String.Compare( + if (string.Compare( newDestinationPath, destinationPath, StringComparison.OrdinalIgnoreCase) == 0) @@ -1650,7 +1650,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.MoveItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -1714,7 +1714,7 @@ namespace Microsoft.PowerShell.Commands // If the destination is the same container as the source container don't do remove // the source item because the source and destination are the same. - if (String.Equals(sourceParent, destination, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(sourceParent, destination, StringComparison.OrdinalIgnoreCase)) { continueWithRemove = false; } @@ -1888,7 +1888,7 @@ namespace Microsoft.PowerShell.Commands object newPropertyValue = property.Value; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -2001,7 +2001,7 @@ namespace Microsoft.PowerShell.Commands foreach (string valueName in filteredPropertyCollection) { string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -2135,7 +2135,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.NewPropertyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -2249,7 +2249,7 @@ namespace Microsoft.PowerShell.Commands { if ( ((!Context.SuppressWildcardExpansion) && (!propertyNamePattern.IsMatch(valueName))) || - (Context.SuppressWildcardExpansion && (!String.Equals(valueName, propertyName, StringComparison.OrdinalIgnoreCase)))) + (Context.SuppressWildcardExpansion && (!string.Equals(valueName, propertyName, StringComparison.OrdinalIgnoreCase)))) { continue; } @@ -2262,7 +2262,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.RemovePropertyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -2350,7 +2350,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.RenamePropertyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -2450,7 +2450,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.CopyPropertyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, sourcePath, @@ -2550,7 +2550,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = RegistryProviderStrings.MovePropertyResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, sourcePath, @@ -2615,7 +2615,7 @@ namespace Microsoft.PowerShell.Commands // to find the parent -- since path elements may contain // path delimiters. We only need to do this comparison // if the base implementation returns something in our namespace. - if (!String.Equals(parentPath, root, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(parentPath, root, StringComparison.OrdinalIgnoreCase)) { bool originalPathExists = ItemExists(path); bool originalPathExistsWithRoot = false; @@ -3053,7 +3053,7 @@ namespace Microsoft.PowerShell.Commands if ( expandAll || ((Context.SuppressWildcardExpansion == false) && (valueNameMatcher.IsMatch(valueNameToMatch))) || - ((Context.SuppressWildcardExpansion == true) && (String.Equals(valueNameToMatch, requestedValueName, StringComparison.OrdinalIgnoreCase)))) + ((Context.SuppressWildcardExpansion == true) && (string.Equals(valueNameToMatch, requestedValueName, StringComparison.OrdinalIgnoreCase)))) { if (string.IsNullOrEmpty(valueNameToMatch)) { @@ -3194,8 +3194,8 @@ namespace Microsoft.PowerShell.Commands } if (string.IsNullOrEmpty(path) || - (String.Compare(path, "\\", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0)) + (string.Compare(path, "\\", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0)) { result = true; } @@ -3271,8 +3271,8 @@ namespace Microsoft.PowerShell.Commands { for (int k = 0; k < s_wellKnownHivesTx.Length; k++) { - if (String.Equals(path, s_hiveNames[k], StringComparison.OrdinalIgnoreCase) || - String.Equals(path, s_hiveShortNames[k], StringComparison.OrdinalIgnoreCase)) + if (string.Equals(path, s_hiveNames[k], StringComparison.OrdinalIgnoreCase) || + string.Equals(path, s_hiveShortNames[k], StringComparison.OrdinalIgnoreCase)) { using (CurrentPSTransaction) { @@ -3285,8 +3285,8 @@ namespace Microsoft.PowerShell.Commands { for (int k = 0; k < s_wellKnownHives.Length; k++) { - if (String.Equals(path, s_hiveNames[k], StringComparison.OrdinalIgnoreCase) || - String.Equals(path, s_hiveShortNames[k], StringComparison.OrdinalIgnoreCase)) + if (string.Equals(path, s_hiveNames[k], StringComparison.OrdinalIgnoreCase) || + string.Equals(path, s_hiveShortNames[k], StringComparison.OrdinalIgnoreCase)) return new RegistryWrapper(s_wellKnownHives[k]); } } diff --git a/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs b/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs index b5e17dd25..8b4746e22 100644 --- a/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs +++ b/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs @@ -206,7 +206,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = SessionStateProviderBaseStrings.SetItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, name, @@ -257,7 +257,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = SessionStateProviderBaseStrings.ClearItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path); @@ -624,7 +624,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = SessionStateProviderBaseStrings.RemoveItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path); @@ -729,7 +729,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = SessionStateProviderBaseStrings.NewItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -805,7 +805,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = SessionStateProviderBaseStrings.CopyItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, path, @@ -922,7 +922,7 @@ namespace Microsoft.PowerShell.Commands string resourceTemplate = SessionStateProviderBaseStrings.RenameItemResourceTemplate; string resource = - String.Format( + string.Format( Host.CurrentCulture, resourceTemplate, name, @@ -930,7 +930,7 @@ namespace Microsoft.PowerShell.Commands if (ShouldProcess(resource, action)) { - if (String.Equals(name, newName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, newName, StringComparison.OrdinalIgnoreCase)) { // This is a no-op. Just get the item for -passthru GetItem(newName); diff --git a/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs b/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs index 663be6779..92a68ea00 100644 --- a/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs +++ b/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs @@ -1148,7 +1148,7 @@ namespace Microsoft.PowerShell.Commands.Internal if (options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) { string resourceTemplate = RegistryProviderStrings.Arg_EnumIllegalVal; - string resource = String.Format(CultureInfo.CurrentCulture, resourceTemplate, options.ToString()); + string resource = string.Format(CultureInfo.CurrentCulture, resourceTemplate, options.ToString()); throw new ArgumentException(resource); } @@ -1278,7 +1278,7 @@ namespace Microsoft.PowerShell.Commands.Internal // we found an empty string. But if we're at the end of the data, // it's just the extra null terminator. if (nextNull != len - 1) - strings.Add(String.Empty); + strings.Add(string.Empty); } } else @@ -1584,7 +1584,7 @@ namespace Microsoft.PowerShell.Commands.Internal else { string resourceTemplate = RegistryProviderStrings.Arg_RegSetBadArrType; - string resource = String.Format(CultureInfo.CurrentCulture, resourceTemplate, value.GetType().Name); + string resource = string.Format(CultureInfo.CurrentCulture, resourceTemplate, value.GetType().Name); throw new ArgumentException(resource); } } @@ -1663,7 +1663,7 @@ namespace Microsoft.PowerShell.Commands.Internal if (str != null) { string resourceTemplate = RegistryProviderStrings.UnauthorizedAccess_RegistryKeyGeneric_Key; - string resource = String.Format(CultureInfo.CurrentCulture, resourceTemplate, str); + string resource = string.Format(CultureInfo.CurrentCulture, resourceTemplate, str); throw new UnauthorizedAccessException(resource); } else @@ -1692,7 +1692,7 @@ namespace Microsoft.PowerShell.Commands.Internal case Win32Native.ERROR_FILE_NOT_FOUND: { string resourceTemplate = RegistryProviderStrings.Arg_RegKeyNotFound; - string resource = String.Format(CultureInfo.CurrentCulture, resourceTemplate, errorCode.ToString(System.Globalization.CultureInfo.InvariantCulture)); + string resource = string.Format(CultureInfo.CurrentCulture, resourceTemplate, errorCode.ToString(System.Globalization.CultureInfo.InvariantCulture)); throw new IOException(resource); } @@ -1709,7 +1709,7 @@ namespace Microsoft.PowerShell.Commands.Internal if (str != null) { string resourceTemplate = RegistryProviderStrings.UnauthorizedAccess_RegistryKeyGeneric_Key; - string resource = String.Format(CultureInfo.CurrentCulture, resourceTemplate, str); + string resource = string.Format(CultureInfo.CurrentCulture, resourceTemplate, str); throw new UnauthorizedAccessException(resource); } else diff --git a/src/System.Management.Automation/namespaces/VariableProvider.cs b/src/System.Management.Automation/namespaces/VariableProvider.cs index 10e20417a..37f5a627b 100644 --- a/src/System.Management.Automation/namespaces/VariableProvider.cs +++ b/src/System.Management.Automation/namespaces/VariableProvider.cs @@ -56,7 +56,7 @@ namespace Microsoft.PowerShell.Commands new PSDriveInfo( DriveNames.VariableDrive, ProviderInfo, - String.Empty, + string.Empty, description, null); @@ -118,7 +118,7 @@ namespace Microsoft.PowerShell.Commands { // ensure the name matches - if (!String.Equals(name, variable.Name, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, variable.Name, StringComparison.OrdinalIgnoreCase)) { PSVariable newVar = new PSVariable(name, variable.Value, variable.Options, variable.Attributes); newVar.Description = variable.Description; diff --git a/src/System.Management.Automation/namespaces/Win32Native.cs b/src/System.Management.Automation/namespaces/Win32Native.cs index bc8ad649a..3d0be5390 100644 --- a/src/System.Management.Automation/namespaces/Win32Native.cs +++ b/src/System.Management.Automation/namespaces/Win32Native.cs @@ -845,7 +845,7 @@ namespace Microsoft.PowerShell.Commands.Internal else { string resourceTemplate = RegistryProviderStrings.UnknownError_Num; - return String.Format(CultureInfo.CurrentCulture, resourceTemplate, errorCode.ToString(System.Globalization.CultureInfo.InvariantCulture)); + return string.Format(CultureInfo.CurrentCulture, resourceTemplate, errorCode.ToString(System.Globalization.CultureInfo.InvariantCulture)); } } diff --git a/src/System.Management.Automation/security/CatalogHelper.cs b/src/System.Management.Automation/security/CatalogHelper.cs index cb9b79095..15a852a1d 100644 --- a/src/System.Management.Automation/security/CatalogHelper.cs +++ b/src/System.Management.Automation/security/CatalogHelper.cs @@ -290,7 +290,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(fileName)) { IntPtr memberAttr = IntPtr.Zero; - string fileRelativePath = String.Empty; + string fileRelativePath = string.Empty; do { memberAttr = NativeMethods.CryptCATCDFEnumAttributesWithCDFTag(resultCDF, memberFile, memberInfo, memberAttr, memberCallBack); @@ -526,7 +526,7 @@ namespace System.Management.Automation // We validate those along with file hashes so we are skipping duplicate entries if (!((catalogVersion == 2) && (pIndirectData.DigestAlgorithm.pszObjId.Equals(new Oid("SHA1").Value, StringComparison.OrdinalIgnoreCase)))) { - string relativePath = String.Empty; + string relativePath = string.Empty; IntPtr memberAttrInfo = IntPtr.Zero; do { @@ -670,7 +670,7 @@ namespace System.Management.Automation foreach (string fileItem in directoryItems) { // if its the catalog file we are validating we will skip it - if (String.Equals(fileItem, catalogFilePath, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(fileItem, catalogFilePath, StringComparison.OrdinalIgnoreCase)) continue; ProcessPathFile(new FileInfo(fileItem), new DirectoryInfo(folderPath), hashAlgorithm, excludedPatterns, ref fileHashes); diff --git a/src/System.Management.Automation/security/MshSignature.cs b/src/System.Management.Automation/security/MshSignature.cs index 78cf8120c..803da0375 100644 --- a/src/System.Management.Automation/security/MshSignature.cs +++ b/src/System.Management.Automation/security/MshSignature.cs @@ -104,7 +104,7 @@ namespace System.Management.Automation private SignatureStatus _status = SignatureStatus.UnknownError; private DWORD _win32Error; private X509Certificate2 _signerCert; - private string _statusMessage = String.Empty; + private string _statusMessage = string.Empty; private X509Certificate2 _timeStamperCert; //private DateTime signedOn = new DateTime(0); diff --git a/src/System.Management.Automation/security/SecureStringHelper.cs b/src/System.Management.Automation/security/SecureStringHelper.cs index cf79d3c65..ae0b5d866 100644 --- a/src/System.Management.Automation/security/SecureStringHelper.cs +++ b/src/System.Management.Automation/security/SecureStringHelper.cs @@ -447,7 +447,7 @@ namespace Microsoft.PowerShell unsafe { if (!CAPI.CryptProtectData(new IntPtr(&dataIn), - String.Empty, + string.Empty, new IntPtr(&entropy), IntPtr.Zero, IntPtr.Zero, diff --git a/src/System.Management.Automation/security/SecurityManager.cs b/src/System.Management.Automation/security/SecurityManager.cs index 9965ca12d..f5736356b 100644 --- a/src/System.Management.Automation/security/SecurityManager.cs +++ b/src/System.Management.Automation/security/SecurityManager.cs @@ -320,7 +320,7 @@ namespace Microsoft.PowerShell // But accept mshxml files from publishers that we // trust, or files in the system protected directories bool reasonSet = false; - if (String.Equals(fi.Extension, ".ps1xml", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(fi.Extension, ".ps1xml", StringComparison.OrdinalIgnoreCase)) { string[] trustedDirectories = new string[] { Platform.GetFolderPath(Environment.SpecialFolder.System), @@ -432,7 +432,7 @@ namespace Microsoft.PowerShell foreach (X509Certificate2 trustedCertificate in trustedPublishers.Certificates) { - if (String.Equals(trustedCertificate.Thumbprint, thumbprint, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(trustedCertificate.Thumbprint, thumbprint, StringComparison.OrdinalIgnoreCase)) if (!IsUntrustedPublisher(signature, file)) return true; } @@ -451,7 +451,7 @@ namespace Microsoft.PowerShell foreach (X509Certificate2 trustedCertificate in trustedPublishers.Certificates) { - if (String.Equals(trustedCertificate.Thumbprint, thumbprint, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(trustedCertificate.Thumbprint, thumbprint, StringComparison.OrdinalIgnoreCase)) return true; } diff --git a/src/System.Management.Automation/security/SecuritySupport.cs b/src/System.Management.Automation/security/SecuritySupport.cs index 93fc4dee6..188878dfc 100644 --- a/src/System.Management.Automation/security/SecuritySupport.cs +++ b/src/System.Management.Automation/security/SecuritySupport.cs @@ -244,7 +244,7 @@ namespace System.Management.Automation.Internal { while (currentProcess != null) { - if (String.Equals(gpScriptPath, + if (string.Equals(gpScriptPath, PsUtils.GetMainModule(currentProcess).FileName, StringComparison.OrdinalIgnoreCase)) { foundGpScriptParent = true; @@ -327,27 +327,27 @@ namespace System.Management.Automation.Internal internal static ExecutionPolicy ParseExecutionPolicy(string policy) { - if (String.Equals(policy, "Bypass", + if (string.Equals(policy, "Bypass", StringComparison.OrdinalIgnoreCase)) { return ExecutionPolicy.Bypass; } - else if (String.Equals(policy, "Unrestricted", + else if (string.Equals(policy, "Unrestricted", StringComparison.OrdinalIgnoreCase)) { return ExecutionPolicy.Unrestricted; } - else if (String.Equals(policy, "RemoteSigned", + else if (string.Equals(policy, "RemoteSigned", StringComparison.OrdinalIgnoreCase)) { return ExecutionPolicy.RemoteSigned; } - else if (String.Equals(policy, "AllSigned", + else if (string.Equals(policy, "AllSigned", StringComparison.OrdinalIgnoreCase)) { return ExecutionPolicy.AllSigned; } - else if (String.Equals(policy, "Restricted", + else if (string.Equals(policy, "Restricted", StringComparison.OrdinalIgnoreCase)) { return ExecutionPolicy.Restricted; @@ -980,7 +980,7 @@ namespace System.Management.Automation if ((contentBytes == null) || (contentBytes.Length == 0)) { - return String.Empty; + return string.Empty; } // After review with the crypto board, NIST_AES256_CBC is more appropriate @@ -1190,7 +1190,7 @@ namespace System.Management.Automation { error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, SecuritySupportStrings.NoCertificateFound, _identifier)), "NoCertificateFound", ErrorCategory.ObjectNotFound, _identifier); } @@ -1256,11 +1256,11 @@ namespace System.Management.Automation if ((resolvedPaths != null) && (resolvedPaths.Count != 0)) { // Ensure the path is from the file system provider - if (!String.Equals(pathProvider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(pathProvider.Name, "FileSystem", StringComparison.OrdinalIgnoreCase)) { error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, SecuritySupportStrings.CertificatePathMustBeFileSystemPath, _identifier)), "CertificatePathMustBeFileSystemPath", ErrorCategory.ObjectNotFound, pathProvider); return; @@ -1422,7 +1422,7 @@ namespace System.Management.Automation { error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, SecuritySupportStrings.CertificateCannotBeUsedForEncryption, certificate.Thumbprint, CertificateFilterInfo.DocumentEncryptionOid)), "CertificateCannotBeUsedForEncryption", ErrorCategory.InvalidData, certificate); return; @@ -1459,7 +1459,7 @@ namespace System.Management.Automation { error = new ErrorRecord( new ArgumentException( - String.Format(CultureInfo.InvariantCulture, + string.Format(CultureInfo.InvariantCulture, SecuritySupportStrings.IdentifierMustReferenceSingleCertificate, _identifier, "To")), "IdentifierMustReferenceSingleCertificate", ErrorCategory.LimitsExceeded, certificatesToProcess); Certificates.Clear(); @@ -1554,7 +1554,7 @@ namespace System.Management.Automation { if (string.IsNullOrEmpty(sourceMetadata)) { - sourceMetadata = String.Empty; + sourceMetadata = string.Empty; } const string EICAR_STRING = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"; diff --git a/src/System.Management.Automation/security/wldpNativeMethods.cs b/src/System.Management.Automation/security/wldpNativeMethods.cs index 477c87b33..0f493c52a 100644 --- a/src/System.Management.Automation/security/wldpNativeMethods.cs +++ b/src/System.Management.Automation/security/wldpNativeMethods.cs @@ -426,7 +426,7 @@ namespace System.Management.Automation.Security // 0000050b-0000-0010-8000-00aa006d2ea4 = ADODB.Parameter if (s_allowDebugOverridePolicy) { - if (String.Equals(clsid.ToString(), "0000050b-0000-0010-8000-00aa006d2ea4", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(clsid.ToString(), "0000050b-0000-0010-8000-00aa006d2ea4", StringComparison.OrdinalIgnoreCase)) { return false; } @@ -443,7 +443,7 @@ namespace System.Management.Automation.Security // Hook for testability. IsClassInApprovedList is only called when the system is in global lockdown mode, // so this wouldn't be allowed in regular ConstrainedLanguage mode. // f6d90f11-9c73-11d3-b32e-00c04f990bb4 = MSXML2.DOMDocument - if (String.Equals(clsid.ToString(), "f6d90f11-9c73-11d3-b32e-00c04f990bb4", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(clsid.ToString(), "f6d90f11-9c73-11d3-b32e-00c04f990bb4", StringComparison.OrdinalIgnoreCase)) { return true; } diff --git a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs index 104dddc4d..cbf51d0ad 100644 --- a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs +++ b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs @@ -130,12 +130,12 @@ namespace System.Management.Automation if (descriptionFallback == null) { - descriptionFallback = String.Empty; + descriptionFallback = string.Empty; } if (vendorFallback == null) { - vendorFallback = String.Empty; + vendorFallback = string.Empty; } Name = name; @@ -263,7 +263,7 @@ namespace System.Management.Automation public Collection Formats { get; } private string _descriptionIndirect; - private string _descriptionFallback = String.Empty; + private string _descriptionFallback = string.Empty; private string _description; /// /// Description of mshsnapin @@ -282,7 +282,7 @@ namespace System.Management.Automation } private string _vendorIndirect; - private string _vendorFallback = String.Empty; + private string _vendorFallback = string.Empty; private string _vendor; /// /// Vendor of mshsnapin @@ -725,7 +725,7 @@ namespace System.Management.Automation string logPipelineExecutionDetailsStr = ReadStringValue(mshsnapinKey, RegistryStrings.MshSnapin_LogPipelineExecutionDetails, false); if (!string.IsNullOrEmpty(logPipelineExecutionDetailsStr)) { - if (String.Compare("1", logPipelineExecutionDetailsStr, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare("1", logPipelineExecutionDetailsStr, StringComparison.OrdinalIgnoreCase) == 0) logPipelineExecutionDetails = true; } diff --git a/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs b/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs index 9c90e6d04..dd4ad7d90 100644 --- a/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs +++ b/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs @@ -106,12 +106,12 @@ namespace System.Management.Automation.Runspaces if (_warning) { _errorRecord = new ErrorRecord(new ParentContainsErrorRecordException(this), "PSSnapInLoadWarning", ErrorCategory.ResourceUnavailable, null); - _errorRecord.ErrorDetails = new ErrorDetails(String.Format(ConsoleInfoErrorStrings.PSSnapInLoadWarning, _PSSnapin, _reason)); + _errorRecord.ErrorDetails = new ErrorDetails(string.Format(ConsoleInfoErrorStrings.PSSnapInLoadWarning, _PSSnapin, _reason)); } else { _errorRecord = new ErrorRecord(new ParentContainsErrorRecordException(this), "PSSnapInLoadFailure", ErrorCategory.ResourceUnavailable, null); - _errorRecord.ErrorDetails = new ErrorDetails(String.Format(ConsoleInfoErrorStrings.PSSnapInLoadFailure, _PSSnapin, _reason)); + _errorRecord.ErrorDetails = new ErrorDetails(string.Format(ConsoleInfoErrorStrings.PSSnapInLoadFailure, _PSSnapin, _reason)); } } } diff --git a/src/System.Management.Automation/utils/ClrFacade.cs b/src/System.Management.Automation/utils/ClrFacade.cs index c4b922284..adfd65ce7 100644 --- a/src/System.Management.Automation/utils/ClrFacade.cs +++ b/src/System.Management.Automation/utils/ClrFacade.cs @@ -304,7 +304,7 @@ namespace System.Management.Automation // it's recommended to use TimeZoneInfo.Local whenever possible. const int maxsizeUtcDmtf = 999; - string UtcString = String.Empty; + string UtcString = string.Empty; // Fill up the UTC field in the DMTF date with the current zones UTC value TimeZoneInfo curZone = TimeZoneInfo.Local; TimeSpan tickOffset = curZone.GetUtcOffset(date); diff --git a/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs b/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs index 4508648b3..9599d388f 100644 --- a/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs +++ b/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs @@ -148,7 +148,7 @@ namespace System.Management.Automation set { _commandName = value; } } - private string _commandName = String.Empty; + private string _commandName = string.Empty; #endregion Properties @@ -416,7 +416,7 @@ namespace System.Management.Automation get { return _commandName; } } - private string _commandName = String.Empty; + private string _commandName = string.Empty; /// /// Gets the PSVersion that the script requires diff --git a/src/System.Management.Automation/utils/CryptoUtils.cs b/src/System.Management.Automation/utils/CryptoUtils.cs index 9abcff203..91cb01424 100644 --- a/src/System.Management.Automation/utils/CryptoUtils.cs +++ b/src/System.Management.Automation/utils/CryptoUtils.cs @@ -336,7 +336,7 @@ namespace System.Management.Automation.Internal /// /// Default constructor /// - public PSCryptoException() : this(0, new StringBuilder(String.Empty)) { } + public PSCryptoException() : this(0, new StringBuilder(string.Empty)) { } /// /// Constructor that will be used from within CryptoUtils @@ -1273,7 +1273,7 @@ namespace System.Management.Automation.Internal } catch (PSCryptoException) { - encryptedSessionKey = String.Empty; + encryptedSessionKey = string.Empty; return false; } @@ -1370,7 +1370,7 @@ namespace System.Management.Automation.Internal } catch (PSCryptoException) { - publicKeyAsString = String.Empty; + publicKeyAsString = string.Empty; return false; } diff --git a/src/System.Management.Automation/utils/ExecutionExceptions.cs b/src/System.Management.Automation/utils/ExecutionExceptions.cs index 6abb90d37..5ea1ac85f 100644 --- a/src/System.Management.Automation/utils/ExecutionExceptions.cs +++ b/src/System.Management.Automation/utils/ExecutionExceptions.cs @@ -711,7 +711,7 @@ namespace System.Management.Automation public override string Message { get { - return _message ?? (_message = (_wrapperException != null) ? _wrapperException.Message : String.Empty); + return _message ?? (_message = (_wrapperException != null) ? _wrapperException.Message : string.Empty); } } diff --git a/src/System.Management.Automation/utils/GraphicalHostReflectionWrapper.cs b/src/System.Management.Automation/utils/GraphicalHostReflectionWrapper.cs index 16b22b1ce..dd50f3acf 100644 --- a/src/System.Management.Automation/utils/GraphicalHostReflectionWrapper.cs +++ b/src/System.Management.Automation/utils/GraphicalHostReflectionWrapper.cs @@ -90,7 +90,7 @@ namespace System.Management.Automation.Internal AssemblyName graphicalHostAssemblyName = new AssemblyName(); graphicalHostAssemblyName.Name = "Microsoft.PowerShell.GraphicalHost"; graphicalHostAssemblyName.Version = new Version(3, 0, 0, 0); - graphicalHostAssemblyName.CultureInfo = new CultureInfo(String.Empty); // Neutral culture + graphicalHostAssemblyName.CultureInfo = new CultureInfo(string.Empty); // Neutral culture graphicalHostAssemblyName.SetPublicKeyToken(new byte[] { 0x31, 0xbf, 0x38, 0x56, 0xad, 0x36, 0x4e, 0x35 }); try diff --git a/src/System.Management.Automation/utils/MshTraceSource.cs b/src/System.Management.Automation/utils/MshTraceSource.cs index 8e671835b..86f5df9b7 100644 --- a/src/System.Management.Automation/utils/MshTraceSource.cs +++ b/src/System.Management.Automation/utils/MshTraceSource.cs @@ -201,7 +201,7 @@ namespace System.Management.Automation // trailing spaces if this actually does pad the name. name = - String.Format( + string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0,-16}", name); diff --git a/src/System.Management.Automation/utils/ParameterBinderExceptions.cs b/src/System.Management.Automation/utils/ParameterBinderExceptions.cs index af1970009..833be5d23 100644 --- a/src/System.Management.Automation/utils/ParameterBinderExceptions.cs +++ b/src/System.Management.Automation/utils/ParameterBinderExceptions.cs @@ -244,7 +244,7 @@ namespace System.Management.Automation ParameterBindingException pbex, string resourceString, params object[] args) - : base(String.Empty, innerException) + : base(string.Empty, innerException) { if (pbex == null) { @@ -403,7 +403,7 @@ namespace System.Management.Automation } } - private string _parameterName = String.Empty; + private string _parameterName = string.Empty; /// /// Gets the type the parameter is expecting. @@ -506,7 +506,7 @@ namespace System.Management.Automation _args.CopyTo(messageArgs, 6); } - string result = String.Empty; + string result = string.Empty; if (!string.IsNullOrEmpty(_resourceString)) { diff --git a/src/System.Management.Automation/utils/PowerShellETWTracer.cs b/src/System.Management.Automation/utils/PowerShellETWTracer.cs index e99acea2e..833d71952 100644 --- a/src/System.Management.Automation/utils/PowerShellETWTracer.cs +++ b/src/System.Management.Automation/utils/PowerShellETWTracer.cs @@ -1137,10 +1137,10 @@ namespace System.Management.Automation.Tracing PSKeyword.UseAlwaysAnalytic, className, methodName, workflowId.ToString(), parameters == null ? message : StringUtil.Format(message, parameters), - String.Empty, // Job - String.Empty, // Activity name - String.Empty, // Activity GUID - String.Empty); + string.Empty, // Job + string.Empty, // Activity name + string.Empty, // Activity GUID + string.Empty); } /// @@ -1189,9 +1189,9 @@ namespace System.Management.Automation.Tracing className, methodName, workflowId.ToString(), parameters == null ? message : StringUtil.Format(message, parameters), sb.ToString(),// Job - String.Empty, // Activity name - String.Empty, // Activity GUID - String.Empty); + string.Empty, // Activity name + string.Empty, // Activity GUID + string.Empty); } /// @@ -1458,10 +1458,10 @@ namespace System.Management.Automation.Tracing PSKeyword.UseAlwaysAnalytic, className, methodName, workflowId.ToString(), parameters == null ? message : StringUtil.Format(message, parameters), - String.Empty, // Job + string.Empty, // Job activityName, activityId.ToString(), - String.Empty); + string.Empty); } /// diff --git a/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs b/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs index af6fa2d5c..b11bd9a94 100644 --- a/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs +++ b/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs @@ -78,7 +78,7 @@ namespace System.Management.Automation // we got back one or more objects. Pick off the first result. if (streamResults[0] == null) - return String.Empty; + return string.Empty; // And convert the base object into a string. We can't use the proxied // ToString() on the PSObject because there is no default runspace @@ -236,7 +236,7 @@ namespace System.Management.Automation internal static PowerShell AddCommandWithPreferenceSetting(this PowerShell powershell, string command, Type type = null) { Diagnostics.Assert(powershell != null, "the passed-in powershell cannot be null"); - Diagnostics.Assert(!String.IsNullOrWhiteSpace(command), + Diagnostics.Assert(!string.IsNullOrWhiteSpace(command), "the passed-in command name should not be null or whitespaces"); if (type != null) diff --git a/src/System.Management.Automation/utils/PsUtils.cs b/src/System.Management.Automation/utils/PsUtils.cs index 1b2948293..2f8550f2d 100644 --- a/src/System.Management.Automation/utils/PsUtils.cs +++ b/src/System.Management.Automation/utils/PsUtils.cs @@ -183,7 +183,7 @@ namespace System.Management.Automation /// internal static string GetTemporaryDirectory() { - string tempDir = String.Empty; + string tempDir = string.Empty; string tempPath = Path.GetTempPath(); do { @@ -197,7 +197,7 @@ namespace System.Management.Automation } catch (UnauthorizedAccessException) { - tempDir = String.Empty; // will become current working directory + tempDir = string.Empty; // will become current working directory } return tempDir; diff --git a/src/System.Management.Automation/utils/SessionStateExceptions.cs b/src/System.Management.Automation/utils/SessionStateExceptions.cs index 9d460f31c..b9695de3d 100644 --- a/src/System.Management.Automation/utils/SessionStateExceptions.cs +++ b/src/System.Management.Automation/utils/SessionStateExceptions.cs @@ -294,7 +294,7 @@ namespace System.Management.Automation if (path == null) { result = - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, format, provider.Name, @@ -303,7 +303,7 @@ namespace System.Management.Automation else { result = - String.Format( + string.Format( System.Globalization.CultureInfo.CurrentCulture, format, provider.Name, @@ -522,7 +522,7 @@ namespace System.Management.Automation get { return _itemName; } } - private string _itemName = String.Empty; + private string _itemName = string.Empty; /// /// Gets the category of session state object the error occurred on. diff --git a/src/System.Management.Automation/utils/StringUtil.cs b/src/System.Management.Automation/utils/StringUtil.cs index c5dee2468..e5d48e804 100644 --- a/src/System.Management.Automation/utils/StringUtil.cs +++ b/src/System.Management.Automation/utils/StringUtil.cs @@ -14,21 +14,21 @@ namespace System.Management.Automation.Internal string Format(string formatSpec, object o) { - return String.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o); + return string.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o); } internal static string Format(string formatSpec, object o1, object o2) { - return String.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o1, o2); + return string.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o1, o2); } internal static string Format(string formatSpec, params object[] o) { - return String.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o); + return string.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o); } internal static diff --git a/src/System.Management.Automation/utils/StructuredTraceSource.cs b/src/System.Management.Automation/utils/StructuredTraceSource.cs index aeeef0590..ef25060ee 100644 --- a/src/System.Management.Automation/utils/StructuredTraceSource.cs +++ b/src/System.Management.Automation/utils/StructuredTraceSource.cs @@ -285,7 +285,7 @@ namespace System.Management.Automation // TODO: move this to startup json file instead of using env var string tracingEnvVar = Environment.GetEnvironmentVariable("MshEnableTrace"); - if (String.Equals( + if (string.Equals( tracingEnvVar, "True", StringComparison.OrdinalIgnoreCase)) @@ -452,7 +452,7 @@ namespace System.Management.Automation { try { - return new ScopeTracer(this, PSTraceSourceOptions.Scope, null, null, String.Empty, msg); + return new ScopeTracer(this, PSTraceSourceOptions.Scope, null, null, string.Empty, msg); } catch { } } @@ -466,7 +466,7 @@ namespace System.Management.Automation { try { - return new ScopeTracer(this, PSTraceSourceOptions.Scope, null, null, String.Empty, format, arg1); + return new ScopeTracer(this, PSTraceSourceOptions.Scope, null, null, string.Empty, format, arg1); } catch { } } @@ -480,7 +480,7 @@ namespace System.Management.Automation { try { - return new ScopeTracer(this, PSTraceSourceOptions.Scope, null, null, String.Empty, format, arg1, arg2); + return new ScopeTracer(this, PSTraceSourceOptions.Scope, null, null, string.Empty, format, arg1, arg2); } catch { } } @@ -1392,7 +1392,7 @@ namespace System.Management.Automation /// /// Gets or sets the description for this trace sources /// - public string Description { get; set; } = String.Empty; + public string Description { get; set; } = string.Empty; /// /// Determines if the line and switch headers should be shown @@ -1403,7 +1403,7 @@ namespace System.Management.Automation /// /// Gets the full name of the trace source category /// - internal string FullName { get; } = String.Empty; + internal string FullName { get; } = string.Empty; private string _name; diff --git a/src/System.Management.Automation/utils/assert.cs b/src/System.Management.Automation/utils/assert.cs index a6d57e86e..9f82fad74 100644 --- a/src/System.Management.Automation/utils/assert.cs +++ b/src/System.Management.Automation/utils/assert.cs @@ -129,7 +129,7 @@ namespace System.Management.Automation bool condition, string whyThisShouldNeverHappen) { - Diagnostics.Assert(condition, whyThisShouldNeverHappen, String.Empty); + Diagnostics.Assert(condition, whyThisShouldNeverHappen, string.Empty); } /// diff --git a/src/System.Management.Automation/utils/perfCounters/CounterSetInstanceBase.cs b/src/System.Management.Automation/utils/perfCounters/CounterSetInstanceBase.cs index e32aef992..32785f5be 100644 --- a/src/System.Management.Automation/utils/perfCounters/CounterSetInstanceBase.cs +++ b/src/System.Management.Automation/utils/perfCounters/CounterSetInstanceBase.cs @@ -101,7 +101,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Denominator for update not valid for the given counter id {0}", counterId)); @@ -370,7 +370,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Lookup for counter corresponding to counter id {0} failed", counterId)); @@ -414,7 +414,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Lookup for counter corresponding to counter name {0} failed", counterName)); @@ -452,7 +452,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Lookup for counter corresponding to counter id {0} failed", counterId)); @@ -498,7 +498,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Lookup for counter corresponding to counter name {0} failed", counterName)); @@ -536,7 +536,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Lookup for counter corresponding to counter id {0} failed", counterId)); @@ -582,7 +582,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "Lookup for counter corresponding to counter name {0} failed", counterName)); diff --git a/src/System.Management.Automation/utils/perfCounters/PSPerfCountersMgr.cs b/src/System.Management.Automation/utils/perfCounters/PSPerfCountersMgr.cs index 126f36748..8ecaf3600 100644 --- a/src/System.Management.Automation/utils/perfCounters/PSPerfCountersMgr.cs +++ b/src/System.Management.Automation/utils/perfCounters/PSPerfCountersMgr.cs @@ -65,7 +65,7 @@ namespace System.Management.Automation.PerformanceData public string GetCounterSetInstanceName() { Process currentProcess = Process.GetCurrentProcess(); - string pid = String.Format(CultureInfo.InvariantCulture, "{0}", currentProcess.Id); + string pid = string.Format(CultureInfo.InvariantCulture, "{0}", currentProcess.Id); return pid; } @@ -114,7 +114,7 @@ namespace System.Management.Automation.PerformanceData if (this.IsCounterSetRegistered(counterSetId, out counterSetInst)) { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "A Counter Set Instance with id '{0}' is already registered", counterSetId)); @@ -132,7 +132,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "A Counter Set Instance with name '{0}' is already registered", counterSetName)); @@ -178,7 +178,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with id '{0}' is registered", counterSetId)); @@ -209,7 +209,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with id '{0}' is registered", counterSetId)); @@ -249,7 +249,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with id '{0}' is registered", counterSetId)); @@ -290,7 +290,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with name {0} is registered", counterSetName)); @@ -321,7 +321,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with id '{0}' is registered", counterSetId)); @@ -352,7 +352,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with id '{0}' is registered", counterSetId)); @@ -392,7 +392,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with name '{0}' is registered", counterSetName)); @@ -432,7 +432,7 @@ namespace System.Management.Automation.PerformanceData { InvalidOperationException invalidOperationException = new InvalidOperationException( - String.Format( + string.Format( CultureInfo.InvariantCulture, "No Counter Set Instance with name '{0}' is registered", counterSetName)); diff --git a/test/tools/WebListener/Controllers/GetController.cs b/test/tools/WebListener/Controllers/GetController.cs index 0cf6cb9a8..13a709417 100644 --- a/test/tools/WebListener/Controllers/GetController.cs +++ b/test/tools/WebListener/Controllers/GetController.cs @@ -20,13 +20,13 @@ namespace mvc.Controllers Hashtable args = new Hashtable(); foreach (var key in Request.Query.Keys) { - args.Add(key, String.Join(Constants.HeaderSeparator, Request.Query[key])); + args.Add(key, string.Join(Constants.HeaderSeparator, Request.Query[key])); } Hashtable headers = new Hashtable(); foreach (var key in Request.Headers.Keys) { - headers.Add(key, String.Join(Constants.HeaderSeparator, Request.Headers[key])); + headers.Add(key, string.Join(Constants.HeaderSeparator, Request.Headers[key])); } Hashtable output = new Hashtable @@ -50,7 +50,7 @@ namespace mvc.Controllers } string data = new StreamReader(Request.Body).ReadToEnd(); - if (!String.IsNullOrEmpty(data)) + if (!string.IsNullOrEmpty(data)) { output["data"] = data; } diff --git a/test/tools/WebListener/Controllers/LinkController.cs b/test/tools/WebListener/Controllers/LinkController.cs index e70a75f66..dcfd94365 100644 --- a/test/tools/WebListener/Controllers/LinkController.cs +++ b/test/tools/WebListener/Controllers/LinkController.cs @@ -27,7 +27,7 @@ namespace mvc.Controllers linkNumber = 1; } - string baseUri = Regex.Replace(UriHelper.GetDisplayUrl(Request), "\\?.*", String.Empty); + string baseUri = Regex.Replace(UriHelper.GetDisplayUrl(Request), "\\?.*", string.Empty); string type = Request.Query.TryGetValue("type", out StringValues typeSV) ? typeSV.FirstOrDefault() : "default"; @@ -86,7 +86,7 @@ namespace mvc.Controllers } else { - linkHeader = String.Join(",", linkList); + linkHeader = string.Join(",", linkList); } Response.Headers.Add("Link", linkHeader); diff --git a/test/tools/WebListener/Controllers/MultipartController.cs b/test/tools/WebListener/Controllers/MultipartController.cs index 959c081d6..43c436819 100644 --- a/test/tools/WebListener/Controllers/MultipartController.cs +++ b/test/tools/WebListener/Controllers/MultipartController.cs @@ -25,7 +25,7 @@ namespace mvc.Controllers } public ActionResult Index() - { + { return View(); } @@ -74,7 +74,7 @@ namespace mvc.Controllers Hashtable headers = new Hashtable(); foreach (var key in Request.Headers.Keys) { - headers.Add(key, String.Join(Constants.HeaderSeparator, Request.Headers[key])); + headers.Add(key, string.Join(Constants.HeaderSeparator, Request.Headers[key])); } Hashtable output = new Hashtable diff --git a/test/tools/WebListener/Controllers/RedirectController.cs b/test/tools/WebListener/Controllers/RedirectController.cs index 3e9a14f98..9af1af6c3 100644 --- a/test/tools/WebListener/Controllers/RedirectController.cs +++ b/test/tools/WebListener/Controllers/RedirectController.cs @@ -38,7 +38,7 @@ namespace mvc.Controllers url = $"{url}?type={type.FirstOrDefault()}"; Response.Headers.Add("Location", url); } - else if (typeIsPresent && String.Equals(type.FirstOrDefault(), "relative", StringComparison.InvariantCultureIgnoreCase)) + else if (typeIsPresent && string.Equals(type.FirstOrDefault(), "relative", StringComparison.InvariantCultureIgnoreCase)) { url = new Uri($"{url}?type={type.FirstOrDefault()}").PathAndQuery; Response.Redirect(url, false); diff --git a/test/tools/WebListener/Controllers/ResponseController.cs b/test/tools/WebListener/Controllers/ResponseController.cs index 339b60bdb..73a900131 100644 --- a/test/tools/WebListener/Controllers/ResponseController.cs +++ b/test/tools/WebListener/Controllers/ResponseController.cs @@ -22,7 +22,7 @@ namespace mvc.Controllers { public String Index() { - string output = String.Empty; + string output = string.Empty; string contentType = Constants.ApplicationJson; StringValues contentTypes; @@ -33,7 +33,7 @@ namespace mvc.Controllers StringValues statusCodes; Int32 statusCode; - if (Request.Query.TryGetValue("statuscode", out statusCodes) && + if (Request.Query.TryGetValue("statuscode", out statusCodes) && Int32.TryParse(statusCodes.FirstOrDefault(), out statusCode)) { Response.StatusCode = statusCode; @@ -61,7 +61,7 @@ namespace mvc.Controllers foreach (JProperty property in (JToken)jobject) { // Only set Content-Type through contenttype field. - if (String.Equals(property.Name, "Content-Type", StringComparison.InvariantCultureIgnoreCase)) + if (string.Equals(property.Name, "Content-Type", StringComparison.InvariantCultureIgnoreCase)) { continue; } diff --git a/test/tools/WebListener/Controllers/ResponseHeadersController.cs b/test/tools/WebListener/Controllers/ResponseHeadersController.cs index 5eab3c826..90a2fad90 100644 --- a/test/tools/WebListener/Controllers/ResponseHeadersController.cs +++ b/test/tools/WebListener/Controllers/ResponseHeadersController.cs @@ -22,9 +22,9 @@ namespace mvc.Controllers Hashtable headers = new Hashtable(); foreach (var key in Request.Query.Keys) { - headers.Add(key, String.Join(Constants.HeaderSeparator, Request.Query[key])); + headers.Add(key, string.Join(Constants.HeaderSeparator, Request.Query[key])); - if (String.Equals("Content-Type", key, StringComparison.InvariantCultureIgnoreCase)) + if (string.Equals("Content-Type", key, StringComparison.InvariantCultureIgnoreCase)) { // Content-Type must be applied right before it is sent to the client or MVC will overwrite. string contentType = Request.Query[key]; @@ -43,7 +43,7 @@ namespace mvc.Controllers return JsonConvert.SerializeObject(headers); } - + public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });