diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs index 507a6b37f..7b544002b 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs @@ -46,7 +46,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.activity = theActivity; this.activityID = theActivityID; this.currentOperation = theCurrentOperation; - if (String.IsNullOrEmpty(theStatusDescription)) + if (string.IsNullOrEmpty(theStatusDescription)) { this.statusDescription = Strings.DefaultStatusDescription; } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs index 92c373fe4..60bb2fca4 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs @@ -78,7 +78,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// internal static bool IsDefaultComputerName(string computerName) { - return String.IsNullOrEmpty(computerName); + return string.IsNullOrEmpty(computerName); } /// diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs index c3e3f87a6..c179964a3 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs @@ -194,7 +194,7 @@ $result FolderItemVerbs verbs = item.Verbs(); foreach (FolderItemVerb verb in verbs) { - if (!String.IsNullOrEmpty(verb.Name) && + if (!string.IsNullOrEmpty(verb.Name) && (verb.Name.Equals(ControlPanelResources.VerbActionOpen, StringComparison.OrdinalIgnoreCase) || CompareVerbActionOpen(verb.Name))) { @@ -224,7 +224,7 @@ $result foreach (ShellFolderItem item in allItems) { string canonicalName = (string)item.ExtendedProperty("System.ApplicationName"); - canonicalName = !String.IsNullOrEmpty(canonicalName) + canonicalName = !string.IsNullOrEmpty(canonicalName) ? canonicalName.Substring(0, canonicalName.IndexOf("\0", StringComparison.OrdinalIgnoreCase)) : null; diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs index 1df79e5f1..947f61916 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs @@ -1268,11 +1268,11 @@ namespace Microsoft.PowerShell.Commands { EventSourceCreationData newEventSource = new EventSourceCreationData(_sourceName, LogName); newEventSource.MachineName = compname; - if (!String.IsNullOrEmpty(MessageResourceFile)) + if (!string.IsNullOrEmpty(MessageResourceFile)) newEventSource.MessageResourceFile = MessageResourceFile; - if (!String.IsNullOrEmpty(ParameterResourceFile)) + if (!string.IsNullOrEmpty(ParameterResourceFile)) newEventSource.ParameterResourceFile = ParameterResourceFile; - if (!String.IsNullOrEmpty(CategoryResourceFile)) + if (!string.IsNullOrEmpty(CategoryResourceFile)) newEventSource.CategoryResourceFile = CategoryResourceFile; EventLog.CreateEventSource(newEventSource); } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs index a3eb7f09d..2044c4d0c 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs @@ -97,7 +97,7 @@ namespace Microsoft.PowerShell.Commands returnValue.Append(String.Join(", ", _property)); returnValue.Append(" from "); returnValue.Append(Class); - if (!String.IsNullOrEmpty(Filter)) + if (!string.IsNullOrEmpty(Filter)) { returnValue.Append(" where "); returnValue.Append(Filter); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs index 633d4926b..46324e7fd 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs @@ -128,7 +128,7 @@ namespace Microsoft.PowerShell.Commands // try to translate the SID to a more friendly username // just stick with the SID if anything goes wrong string installed = (string)obj["InstalledBy"]; - if (!String.IsNullOrEmpty(installed)) + if (!string.IsNullOrEmpty(installed)) { try { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs index fe0c21a71..3f638c7b6 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs @@ -157,7 +157,7 @@ namespace Microsoft.PowerShell.Commands if (_path != null) { mPath = new ManagementPath(_path); - if (String.IsNullOrEmpty(mPath.NamespacePath)) + if (string.IsNullOrEmpty(mPath.NamespacePath)) { mPath.NamespacePath = this.Namespace; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs index 7b17c88dc..7c75eb70d 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs @@ -1377,11 +1377,11 @@ namespace Microsoft.PowerShell.Commands { tracer.WriteLine("ProviderName: {0}", providerName); - bool providerNameEmpty = String.IsNullOrEmpty(providerName); + bool providerNameEmpty = string.IsNullOrEmpty(providerName); bool providerNameContainsWildcardCharacters = WildcardPattern.ContainsWildcardCharacters(providerName); - bool driveNameEmpty = String.IsNullOrEmpty(driveName); + bool driveNameEmpty = string.IsNullOrEmpty(driveName); bool driveNameContainsWildcardCharacters = WildcardPattern.ContainsWildcardCharacters(driveName); @@ -1400,7 +1400,7 @@ namespace Microsoft.PowerShell.Commands // exist. if (!driveNameEmpty && !driveNameContainsWildcardCharacters) { - if (String.IsNullOrEmpty(scope)) + if (string.IsNullOrEmpty(scope)) { SessionState.Drive.Get(driveName); } @@ -2079,7 +2079,7 @@ namespace Microsoft.PowerShell.Commands if (Path != null && Path.Length > 0) { // Path is only globbed if Name is specified. - if (String.IsNullOrEmpty(Name)) + if (string.IsNullOrEmpty(Name)) return InvokeProvider.Item.NewItemDynamicParameters(WildcardPattern.Escape(Path[0]), ItemType, Value, context); else return InvokeProvider.Item.NewItemDynamicParameters(Path[0], ItemType, Value, context); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs index 41c2c9e2f..696ee678e 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs @@ -1930,7 +1930,7 @@ namespace Microsoft.PowerShell.Commands { NetworkCredential nwcredential = _credential.GetNetworkCredential(); startInfo.UserName = nwcredential.UserName; - if (String.IsNullOrEmpty(nwcredential.Domain)) + if (string.IsNullOrEmpty(nwcredential.Domain)) { startInfo.Domain = "."; } @@ -2175,7 +2175,7 @@ namespace Microsoft.PowerShell.Commands private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLine) { - if (!String.IsNullOrEmpty(outLine.Data)) + if (!string.IsNullOrEmpty(outLine.Data)) { _outputWriter.WriteLine(outLine.Data); _outputWriter.Flush(); @@ -2184,7 +2184,7 @@ namespace Microsoft.PowerShell.Commands private void StdErrorHandler(object sendingProcess, DataReceivedEventArgs outLine) { - if (!String.IsNullOrEmpty(outLine.Data)) + if (!string.IsNullOrEmpty(outLine.Data)) { _errorWriter.WriteLine(outLine.Data); _errorWriter.Flush(); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs index 6b2dcda2c..e7d83737e 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs @@ -134,7 +134,7 @@ namespace Microsoft.PowerShell.Commands if (this.Credential != null) { System.Net.NetworkCredential cred = this.Credential.GetNetworkCredential(); - if (String.IsNullOrEmpty(cred.Domain)) + if (string.IsNullOrEmpty(cred.Domain)) { conOptions.Username = cred.UserName; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs index 4ac4fe56b..b8f15327b 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs @@ -98,7 +98,7 @@ namespace Microsoft.PowerShell.Commands if (_path != null) { mPath = new ManagementPath(_path); - if (String.IsNullOrEmpty(mPath.NamespacePath)) + if (string.IsNullOrEmpty(mPath.NamespacePath)) { mPath.NamespacePath = this.Namespace; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index 755130dfd..ca0ddcc0a 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -1660,7 +1660,7 @@ namespace Microsoft.PowerShell.Commands objServiceShouldBeDisposed = true; } - Diagnostics.Assert(!String.IsNullOrEmpty(Name), "null ServiceName"); + Diagnostics.Assert(!string.IsNullOrEmpty(Name), "null ServiceName"); // "new ServiceController" will succeed even if // there is no such service. This checks whether @@ -1733,7 +1733,7 @@ namespace Microsoft.PowerShell.Commands return; } // Modify startup type or display name or credential - if (!String.IsNullOrEmpty(DisplayName) + if (!string.IsNullOrEmpty(DisplayName) || ServiceStartupType.InvalidValue != StartupType || Credential != null) { DWORD dwStartType = NativeMethods.SERVICE_NO_CHANGE; @@ -2055,9 +2055,9 @@ namespace Microsoft.PowerShell.Commands [ArchitectureSensitive] protected override void BeginProcessing() { - Diagnostics.Assert(!String.IsNullOrEmpty(Name), + Diagnostics.Assert(!string.IsNullOrEmpty(Name), "null ServiceName"); - Diagnostics.Assert(!String.IsNullOrEmpty(BinaryPathName), + Diagnostics.Assert(!string.IsNullOrEmpty(BinaryPathName), "null BinaryPathName"); // confirm the operation first @@ -2336,7 +2336,7 @@ namespace Microsoft.PowerShell.Commands objServiceShouldBeDisposed = true; } - Diagnostics.Assert(!String.IsNullOrEmpty(Name), "null ServiceName"); + Diagnostics.Assert(!string.IsNullOrEmpty(Name), "null ServiceName"); // "new ServiceController" will succeed even if there is no such service. // This checks whether the service actually exists. diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs index bf540946a..a52f9093f 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs @@ -120,7 +120,7 @@ namespace Microsoft.PowerShell.Commands { case propertyValuePathSet: case propertyValueLiteralPathSet: - if (!String.IsNullOrEmpty(Name)) + if (!string.IsNullOrEmpty(Name)) { mshObject = new PSObject(); mshObject.Properties.Add(new PSNoteProperty(Name, Value)); diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs index eba405ce5..870f8e935 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands returnValue.Append(String.Join(", ", getObject.Property)); returnValue.Append(" from "); returnValue.Append(getObject.Class); - if (!String.IsNullOrEmpty(getObject.Filter)) + if (!string.IsNullOrEmpty(getObject.Filter)) { returnValue.Append(" where "); returnValue.Append(getObject.Filter); @@ -303,7 +303,7 @@ namespace Microsoft.PowerShell.Commands else { mPath = new ManagementPath(setObject.Path); - if (String.IsNullOrEmpty(mPath.NamespacePath)) + if (string.IsNullOrEmpty(mPath.NamespacePath)) { mPath.NamespacePath = setObject.Namespace; } @@ -537,7 +537,7 @@ namespace Microsoft.PowerShell.Commands if (invokeObject.Path != null) { mPath = new ManagementPath(invokeObject.Path); - if (String.IsNullOrEmpty(mPath.NamespacePath)) + if (string.IsNullOrEmpty(mPath.NamespacePath)) { mPath.NamespacePath = invokeObject.Namespace; } @@ -749,7 +749,7 @@ namespace Microsoft.PowerShell.Commands if (removeObject.Path != null) { mPath = new ManagementPath(removeObject.Path); - if (String.IsNullOrEmpty(mPath.NamespacePath)) + if (string.IsNullOrEmpty(mPath.NamespacePath)) { mPath.NamespacePath = removeObject.Namespace; } @@ -1312,7 +1312,7 @@ namespace Microsoft.PowerShell.Commands else { mPath = new ManagementPath(wmiInstance.Path); - if (String.IsNullOrEmpty(mPath.NamespacePath)) + if (string.IsNullOrEmpty(mPath.NamespacePath)) { mPath.NamespacePath = wmiInstance.Namespace; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs index efe417611..318a4f604 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs @@ -467,7 +467,7 @@ namespace Microsoft.PowerShell.Commands CultureInfo.InvariantCulture, GetMethodTemplate(language), typeName, sourceCodeText); - if (!String.IsNullOrEmpty(typeNamespace)) + if (!string.IsNullOrEmpty(typeNamespace)) { return usingSource + String.Format( CultureInfo.InvariantCulture, @@ -572,7 +572,7 @@ namespace Microsoft.PowerShell.Commands { // Generate an error if they've specified an output // assembly type without an output assembly - if (String.IsNullOrEmpty(_outputAssembly) && this.MyInvocation.BoundParameters.ContainsKey(nameof(OutputType))) + if (string.IsNullOrEmpty(_outputAssembly) && this.MyInvocation.BoundParameters.ContainsKey(nameof(OutputType))) { ErrorRecord errorRecord = new ErrorRecord( new Exception( @@ -621,7 +621,7 @@ namespace Microsoft.PowerShell.Commands // These assemblies are used, when ReferencedAssemblies parameter is not specified. private static Lazy> s_defaultAssemblies = new Lazy>(InitDefaultRefAssemblies); - private bool InMemory { get { return String.IsNullOrEmpty(_outputAssembly); } } + private bool InMemory { get { return string.IsNullOrEmpty(_outputAssembly); } } // These dictionaries prevent reloading already loaded and unchanged code. // We don't worry about unbounded growing of the cache because in .Net Core 2.0 we can not unload assemblies. @@ -1005,7 +1005,7 @@ namespace Microsoft.PowerShell.Commands break; } - if (!String.IsNullOrEmpty(_outputAssembly) && !PassThru.IsPresent) + if (!string.IsNullOrEmpty(_outputAssembly) && !PassThru.IsPresent) { CompileToAssembly(syntaxTrees, compilationOptions, emitOptions); } @@ -1316,7 +1316,7 @@ namespace Microsoft.PowerShell.Commands { int hash; - if (String.IsNullOrEmpty(st.FilePath)) + if (string.IsNullOrEmpty(st.FilePath)) { // If the file name does not exist, the source text is set by the user using parameters. // In this case, we assume that the source text is of a small size and we can re-allocate by ToString(). diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs index ea4a9ad66..aa713ebe3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs @@ -1309,7 +1309,7 @@ namespace Microsoft.PowerShell.Commands if (values.Count == 0) break; - if (values.Count == 1 && String.IsNullOrEmpty(values[0])) + if (values.Count == 1 && string.IsNullOrEmpty(values[0])) { // skip the blank lines continue; @@ -1340,7 +1340,7 @@ namespace Microsoft.PowerShell.Commands HashSet headers = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (string currentHeader in names) { - if (!String.IsNullOrEmpty(currentHeader)) + if (!string.IsNullOrEmpty(currentHeader)) { if (!headers.Contains(currentHeader)) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-StringData.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-StringData.cs index 0698e150f..acd358419 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-StringData.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-StringData.cs @@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.Commands { Hashtable result = new Hashtable(StringComparer.OrdinalIgnoreCase); - if (String.IsNullOrEmpty(_stringData)) + if (string.IsNullOrEmpty(_stringData)) { WriteObject(result); return; @@ -55,7 +55,7 @@ namespace Microsoft.PowerShell.Commands { string s = line.Trim(); - if (String.IsNullOrEmpty(s) || s[0] == '#') + if (string.IsNullOrEmpty(s) || s[0] == '#') continue; int index = s.IndexOf('='); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs index 18e1e371a..2e61a7a97 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs @@ -195,7 +195,7 @@ namespace Microsoft.PowerShell.Commands // First get the alias table (from the proper scope if necessary) IDictionary aliasTable = null; - if (!String.IsNullOrEmpty(Scope)) + if (!string.IsNullOrEmpty(Scope)) { // This can throw PSArgumentException and PSArgumentOutOfRangeException // but just let them go as this is terminal for the pipeline and the diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs index bd8b33a44..02d2651bf 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs @@ -95,7 +95,7 @@ namespace Microsoft.PowerShell.Commands //get the command origin CommandOrigin origin = MyInvocation.CommandOrigin; string displayString = "name"; - if (!String.IsNullOrEmpty(Scope)) + if (!string.IsNullOrEmpty(Scope)) { // This can throw PSArgumentException and PSArgumentOutOfRangeException // but just let them go as this is terminal for the pipeline and the diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs index a9a9e4323..7927a85e5 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/Import-LocalizedData.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs index 86f9afb1c..92ad25620 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs @@ -243,9 +243,9 @@ namespace Microsoft.PowerShell.Commands private string GetFilePath() { - if (String.IsNullOrEmpty(_fileName)) + if (string.IsNullOrEmpty(_fileName)) { - if (InvocationExtent == null || String.IsNullOrEmpty(InvocationExtent.File)) + if (InvocationExtent == null || string.IsNullOrEmpty(InvocationExtent.File)) { throw PSTraceSource.NewInvalidOperationException(ImportLocalizedDataStrings.NotCalledFromAScriptFile); } @@ -253,9 +253,9 @@ namespace Microsoft.PowerShell.Commands string dir = _baseDirectory; - if (String.IsNullOrEmpty(dir)) + if (string.IsNullOrEmpty(dir)) { - if (InvocationExtent != null && !String.IsNullOrEmpty(InvocationExtent.File)) + if (InvocationExtent != null && !string.IsNullOrEmpty(InvocationExtent.File)) { dir = Path.GetDirectoryName(InvocationExtent.File); } @@ -268,13 +268,13 @@ namespace Microsoft.PowerShell.Commands dir = PathUtils.ResolveFilePath(dir, this); string fileName = _fileName; - if (String.IsNullOrEmpty(fileName)) + if (string.IsNullOrEmpty(fileName)) { fileName = InvocationExtent.File; } else { - if (!String.IsNullOrEmpty(Path.GetDirectoryName(fileName))) + if (!string.IsNullOrEmpty(Path.GetDirectoryName(fileName))) { throw PSTraceSource.NewInvalidOperationException(ImportLocalizedDataStrings.FileNameParameterCannotHavePath); } @@ -302,7 +302,7 @@ namespace Microsoft.PowerShell.Commands CultureInfo currentCulture = culture; string filePath; string fullFileName = fileName + ".psd1"; - while (currentCulture != null && !String.IsNullOrEmpty(currentCulture.Name)) + while (currentCulture != null && !string.IsNullOrEmpty(currentCulture.Name)) { filePath = Path.Combine(dir, currentCulture.Name, fullFileName); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImportAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImportAliasCommand.cs index 3e7ebcb8b..8ccd9a3a8 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImportAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImportAliasCommand.cs @@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands if (!Force) { AliasInfo existingAlias = null; - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { existingAlias = SessionState.Internal.GetAlias(alias.Name); } @@ -181,7 +181,7 @@ namespace Microsoft.PowerShell.Commands try { - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { result = SessionState.Internal.SetAliasItem(alias, Force, MyInvocation.CommandOrigin); } @@ -369,7 +369,7 @@ namespace Microsoft.PowerShell.Commands Context, options); - if (!String.IsNullOrEmpty(values[2])) + if (!string.IsNullOrEmpty(values[2])) { newAlias.Description = values[2]; } 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 ccb2f6332..6ccd80df0 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs @@ -655,7 +655,7 @@ namespace Microsoft.PowerShell.Commands /// Number of chars in inStr. internal static int CountChar(string inStr, bool ignoreWhiteSpace) { - if (String.IsNullOrEmpty(inStr)) + if (string.IsNullOrEmpty(inStr)) { return 0; } @@ -684,7 +684,7 @@ namespace Microsoft.PowerShell.Commands /// Number of words in inStr. internal static int CountWord(string inStr) { - if (String.IsNullOrEmpty(inStr)) + if (string.IsNullOrEmpty(inStr)) { return 0; } @@ -718,7 +718,7 @@ namespace Microsoft.PowerShell.Commands /// Number of lines in inStr. internal static int CountLine(string inStr) { - if (String.IsNullOrEmpty(inStr)) + if (string.IsNullOrEmpty(inStr)) { return 0; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewAliasCommand.cs index c80fc2a25..7d1e386f7 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewAliasCommand.cs @@ -26,7 +26,7 @@ namespace Microsoft.PowerShell.Commands if (!Force) { AliasInfo existingAlias = null; - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { existingAlias = SessionState.Internal.GetAlias(Name); } @@ -84,7 +84,7 @@ namespace Microsoft.PowerShell.Commands try { - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { result = SessionState.Internal.SetAliasItem(newAlias, Force, MyInvocation.CommandOrigin); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs index 4d51fec69..f13220a9c 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs @@ -100,7 +100,7 @@ namespace Microsoft.PowerShell.Commands string element = (string)LanguagePrimitives.ConvertTo(e.Current, typeof(string), CultureInfo.InvariantCulture); - if (!String.IsNullOrEmpty(element)) + if (!string.IsNullOrEmpty(element)) { // Prepend a space if the stringbuilder isn't empty... // We could consider using $OFS here but that's probably more diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveAliasCommand.cs index 26a0c8f06..8a32bfa30 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/RemoveAliasCommand.cs @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Commands foreach (string aliasName in Name) { AliasInfo existingAlias = null; - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { existingAlias = SessionState.Internal.GetAlias(aliasName); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetAliasCommand.cs index eb0495b5c..5e3f54c92 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetAliasCommand.cs @@ -45,7 +45,7 @@ namespace Microsoft.PowerShell.Commands try { - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { result = SessionState.Internal.SetAliasItem(aliasToSet, Force, MyInvocation.CommandOrigin); } 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 b97d4fd8e..dea173920 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs @@ -574,7 +574,7 @@ namespace Microsoft.PowerShell.Commands private void EnsureMemberNameHasBeenSpecified() { - if (String.IsNullOrEmpty(_memberName)) + if (string.IsNullOrEmpty(_memberName)) { ThrowTerminatingError(NewError("MemberNameShouldBeSpecified", UpdateDataStrings.ShouldBeSpecified, null, "MemberName", _memberType)); } @@ -592,7 +592,7 @@ namespace Microsoft.PowerShell.Commands { if (_value1 is string) { - if (String.IsNullOrEmpty((string)_value1)) + if (string.IsNullOrEmpty((string)_value1)) { ThrowTerminatingError(NewError("ValueShouldBeSpecified", UpdateDataStrings.ShouldNotBeNull, null, "Value", _memberType)); } @@ -1204,7 +1204,7 @@ namespace Microsoft.PowerShell.Commands typeNameToRemove = _typeName; } - Dbg.Assert(!String.IsNullOrEmpty(typeNameToRemove), "TypeNameToRemove should be not null and not empty at this point"); + Dbg.Assert(!string.IsNullOrEmpty(typeNameToRemove), "TypeNameToRemove should be not null and not empty at this point"); TypeData type = new TypeData(typeNameToRemove); string removeTypeFormattedTarget = string.Format(CultureInfo.InvariantCulture, removeTypeTarget, typeNameToRemove); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs index f5ba3f3a1..beb5f1418 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs @@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands List result = new List(); - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { name = "*"; } @@ -157,7 +157,7 @@ namespace Microsoft.PowerShell.Commands // view. IDictionary variableTable = null; - if (String.IsNullOrEmpty(lookupScope)) + if (string.IsNullOrEmpty(lookupScope)) { variableTable = SessionState.Internal.GetVariableTable(); } @@ -480,7 +480,7 @@ namespace Microsoft.PowerShell.Commands if (!Force) { PSVariable varFound = null; - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { varFound = SessionState.PSVariable.GetAtScope(Name, "local"); @@ -532,7 +532,7 @@ namespace Microsoft.PowerShell.Commands try { - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { SessionState.Internal.NewVariable(newVariable, Force); } @@ -818,7 +818,7 @@ namespace Microsoft.PowerShell.Commands bool wasFiltered = false; - if (!String.IsNullOrEmpty(Scope)) + if (!string.IsNullOrEmpty(Scope)) { // We really only need to find matches if the scope was specified. // If the scope wasn't specified then we need to create the @@ -851,7 +851,7 @@ namespace Microsoft.PowerShell.Commands { ScopedItemOptions newOptions = ScopedItemOptions.None; - if (!String.IsNullOrEmpty(Scope) && + if (!string.IsNullOrEmpty(Scope) && String.Equals("private", Scope, StringComparison.OrdinalIgnoreCase)) { newOptions = ScopedItemOptions.Private; @@ -895,7 +895,7 @@ namespace Microsoft.PowerShell.Commands { object result = null; - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { result = SessionState.Internal.SetVariable(varToSet, Force, origin); @@ -1151,7 +1151,7 @@ namespace Microsoft.PowerShell.Commands { try { - if (String.IsNullOrEmpty(Scope)) + if (string.IsNullOrEmpty(Scope)) { SessionState.Internal.RemoveVariable(matchingVariable, _force); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs index 607f6e744..804d0746d 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs @@ -166,7 +166,7 @@ namespace Microsoft.PowerShell.Commands // fill the Content buffer string characterSet = WebResponseHelper.GetCharacterSet(BaseResponse); - if (String.IsNullOrEmpty(characterSet) && ContentHelper.IsJson(contentType)) + if (string.IsNullOrEmpty(characterSet) && ContentHelper.IsJson(contentType)) { characterSet = Encoding.UTF8.HeaderName; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/ContentHelper.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/ContentHelper.Common.cs index b33ae6610..7685ff7c3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/ContentHelper.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/ContentHelper.Common.cs @@ -133,7 +133,7 @@ namespace Microsoft.PowerShell.Commands private static bool CheckIsJson(string contentType) { - if (String.IsNullOrEmpty(contentType)) + if (string.IsNullOrEmpty(contentType)) return false; // the correct type for JSON content, as specified in RFC 4627 @@ -152,7 +152,7 @@ namespace Microsoft.PowerShell.Commands private static bool CheckIsText(string contentType) { - if (String.IsNullOrEmpty(contentType)) + if (string.IsNullOrEmpty(contentType)) return false; // any text, xml or json types are text @@ -189,7 +189,7 @@ namespace Microsoft.PowerShell.Commands private static bool CheckIsXml(string contentType) { - if (String.IsNullOrEmpty(contentType)) + if (string.IsNullOrEmpty(contentType)) return false; // RFC 3023: Media types with the suffix "+xml" are XML @@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Commands private static string GetContentTypeSignature(string contentType) { - if (String.IsNullOrEmpty(contentType)) + if (string.IsNullOrEmpty(contentType)) return null; string sig = contentType.Split(s_contentTypeParamSeparator, 2)[0].ToUpperInvariant(); 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 6b6a3700f..a17212cd2 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 @@ -443,7 +443,7 @@ namespace Microsoft.PowerShell.Commands StreamHelper.SaveStreamToFile(responseStream, QualifiedOutFile, this); } - if (!String.IsNullOrEmpty(ResponseHeadersVariable)) + if (!string.IsNullOrEmpty(ResponseHeadersVariable)) { PSVariableIntrinsics vi = SessionState.PSVariable; vi.Set(ResponseHeadersVariable, WebResponseHelper.GetHeadersDictionary(response)); 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 fd3c1368d..baef6ab1c 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 @@ -1545,7 +1545,7 @@ namespace Microsoft.PowerShell.Commands } } - if (!String.IsNullOrEmpty(detailMsg)) + if (!string.IsNullOrEmpty(detailMsg)) { er.ErrorDetails = new ErrorDetails(detailMsg); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs index 270eff0a0..ba2a64586 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs @@ -1114,7 +1114,7 @@ namespace Microsoft.PowerShell.Commands set { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { _path = inputStream; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs index b150c656c..4514b943c 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs @@ -438,7 +438,7 @@ namespace Microsoft.PowerShell.Commands _propertyMshParameterList = ProcessParameter(_property); - if (!String.IsNullOrEmpty(_title)) + if (!string.IsNullOrEmpty(_title)) { WebUtility.HtmlEncode(_title); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceCommandBase.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceCommandBase.cs index e670484c4..1a07f9a93 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceCommandBase.cs @@ -63,7 +63,7 @@ namespace Microsoft.PowerShell.Commands { bool matchFound = false; - if (String.IsNullOrEmpty(patternToMatch)) + if (string.IsNullOrEmpty(patternToMatch)) { notMatched.Add(patternToMatch); continue; 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 a30fe500b..a5ff2b59b 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs @@ -135,7 +135,7 @@ namespace Microsoft.PowerShell.Commands foreach (string notMatchedName in notMatched) { - if (String.IsNullOrEmpty(notMatchedName)) + if (string.IsNullOrEmpty(notMatchedName)) { continue; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs index 5c26342c7..3af1f84eb 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs @@ -319,7 +319,7 @@ namespace Microsoft.PowerShell.Commands } string errid = ErrorId; - if (String.IsNullOrEmpty(errid)) + if (string.IsNullOrEmpty(errid)) { errid = e.GetType().FullName; } @@ -331,14 +331,14 @@ namespace Microsoft.PowerShell.Commands TargetObject ); - if (this.Exception != null && !String.IsNullOrEmpty(msg)) + if (this.Exception != null && !string.IsNullOrEmpty(msg)) { errorRecord.ErrorDetails = new ErrorDetails(msg); } } string recact = RecommendedAction; - if (!String.IsNullOrEmpty(recact)) + if (!string.IsNullOrEmpty(recact)) { if (errorRecord.ErrorDetails == null) { @@ -348,13 +348,13 @@ namespace Microsoft.PowerShell.Commands errorRecord.ErrorDetails.RecommendedAction = recact; } - if (!String.IsNullOrEmpty(CategoryActivity)) + if (!string.IsNullOrEmpty(CategoryActivity)) errorRecord.CategoryInfo.Activity = CategoryActivity; - if (!String.IsNullOrEmpty(CategoryReason)) + if (!string.IsNullOrEmpty(CategoryReason)) errorRecord.CategoryInfo.Reason = CategoryReason; - if (!String.IsNullOrEmpty(CategoryTargetName)) + if (!string.IsNullOrEmpty(CategoryTargetName)) errorRecord.CategoryInfo.TargetName = CategoryTargetName; - if (!String.IsNullOrEmpty(CategoryTargetType)) + if (!string.IsNullOrEmpty(CategoryTargetType)) errorRecord.CategoryInfo.TargetType = CategoryTargetType; /* 2005/01/25 removing throw-error @@ -373,7 +373,7 @@ namespace Microsoft.PowerShell.Commands { errorRecord.SetInvocationInfo(myInvocation); errorRecord.PreserveInvocationInfoOnce = true; - if (!String.IsNullOrEmpty(CategoryActivity)) + if (!string.IsNullOrEmpty(CategoryActivity)) errorRecord.CategoryInfo.Activity = CategoryActivity; else errorRecord.CategoryInfo.Activity = "Write-Error"; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs index af55d568b..c325b3296 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -611,7 +611,7 @@ namespace Microsoft.PowerShell private static bool MatchSwitch(string switchKey, string match, string smallestUnambiguousMatch) { Dbg.Assert(switchKey != null, "need a value"); - Dbg.Assert(!String.IsNullOrEmpty(match), "need a value"); + Dbg.Assert(!string.IsNullOrEmpty(match), "need a value"); Dbg.Assert(match.Trim().ToLowerInvariant() == match, "match should be normalized to lowercase w/ no outside whitespace"); Dbg.Assert(smallestUnambiguousMatch.Trim().ToLowerInvariant() == smallestUnambiguousMatch, "match should be normalized to lowercase w/ no outside whitespace"); Dbg.Assert(match.Contains(smallestUnambiguousMatch), "sUM should be a substring of match"); @@ -638,7 +638,7 @@ namespace Microsoft.PowerShell private void DisplayBanner() { // If banner text is not supplied do nothing. - if (!String.IsNullOrEmpty(_bannerText)) + if (!string.IsNullOrEmpty(_bannerText)) { _hostUI.WriteLine(_bannerText); _hostUI.WriteLine(); diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs index c74fdc6ca..b6f98583b 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs @@ -2536,7 +2536,7 @@ namespace Microsoft.PowerShell Dbg.Assert(!consoleHandle.IsInvalid, "ConsoleHandle is not valid"); Dbg.Assert(!consoleHandle.IsClosed, "ConsoleHandle is closed"); - if (String.IsNullOrEmpty(output)) + if (string.IsNullOrEmpty(output)) return; // Native WriteConsole doesn't support output buffer longer than 64K. diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 288ae7f2c..023df86e2 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -1362,7 +1362,7 @@ namespace Microsoft.PowerShell #if !UNIX // See if we need to change the process-wide execution // policy - if (!String.IsNullOrEmpty(cpp.ExecutionPolicy)) + if (!string.IsNullOrEmpty(cpp.ExecutionPolicy)) { ExecutionPolicy executionPolicy = SecuritySupport.ParseExecutionPolicy(cpp.ExecutionPolicy); SecuritySupport.SetExecutionPolicy(ExecutionPolicyScope.Process, executionPolicy, null); @@ -1463,7 +1463,7 @@ namespace Microsoft.PowerShell private Exception InitializeRunspaceHelper(string command, Executor exec, Executor.ExecutionOptions options) { - Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value"); + Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value"); Dbg.Assert(exec != null, "non-null Executor instance needed"); s_runspaceInitTracer.WriteLine("running command {0}", command); @@ -1829,7 +1829,7 @@ namespace Microsoft.PowerShell ReportException(e1, exec); } } - else if (!String.IsNullOrEmpty(initialCommand)) + else if (!string.IsNullOrEmpty(initialCommand)) { // Run the command passed on the command line @@ -1884,7 +1884,7 @@ namespace Microsoft.PowerShell private void RunProfile(string profileFileName, Executor exec) { - if (!String.IsNullOrEmpty(profileFileName)) + if (!string.IsNullOrEmpty(profileFileName)) { s_runspaceInitTracer.WriteLine("checking profile" + profileFileName); @@ -2700,7 +2700,7 @@ namespace Microsoft.PowerShell Exception unused = null; string promptString = _promptExec.ExecuteCommandAndGetResultAsString("prompt", out unused); - if (String.IsNullOrEmpty(promptString)) + if (string.IsNullOrEmpty(promptString)) { promptString = ConsoleHostStrings.DefaultPrompt; } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index 6c3ec0eb0..ead6a624e 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -884,7 +884,7 @@ namespace Microsoft.PowerShell { List result = new List(); - if (String.IsNullOrEmpty(text)) + if (string.IsNullOrEmpty(text)) { return result; } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePrompt.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePrompt.cs index 16bcb07ea..53a93f50a 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePrompt.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePrompt.cs @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell { if (fd != null) { - if (!String.IsNullOrEmpty(fd.HelpMessage)) + if (!string.IsNullOrEmpty(fd.HelpMessage)) { return true; } @@ -113,7 +113,7 @@ namespace Microsoft.PowerShell Boolean cancelInput = false; - if (!String.IsNullOrEmpty(caption)) + if (!string.IsNullOrEmpty(caption)) { // Should be a skin lookup @@ -122,7 +122,7 @@ namespace Microsoft.PowerShell WriteLineToConsole(); } - if (!String.IsNullOrEmpty(message)) + if (!string.IsNullOrEmpty(message)) { WriteLineToConsole(WrapToCurrentWindowWidth(message)); } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs index e9959bdcb..9ddedee13 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs @@ -156,7 +156,7 @@ namespace Microsoft.PowerShell internal void ExecuteCommandAsync(string command, out Exception exceptionThrown, ExecutionOptions options) { Dbg.Assert(!useNestedPipelines, "can't async invoke a nested pipeline"); - Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value"); + Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value"); bool addToHistory = (options & ExecutionOptions.AddToHistory) > 0; Pipeline tempPipeline = _parent.RunspaceRef.CreatePipeline(command, addToHistory, false); @@ -294,7 +294,7 @@ namespace Microsoft.PowerShell internal Pipeline CreatePipeline(string command, bool addToHistory) { - Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value"); + Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value"); return _parent.RunspaceRef.CreatePipeline(command, addToHistory, useNestedPipelines); } @@ -322,7 +322,7 @@ namespace Microsoft.PowerShell /// internal Collection ExecuteCommand(string command, out Exception exceptionThrown, ExecutionOptions options) { - Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value"); + Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value"); // Experimental: // Check for implicit remoting commands that can be batched, and execute as batched if able. @@ -556,7 +556,7 @@ namespace Microsoft.PowerShell { exceptionThrown = null; - Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value"); + Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value"); bool? result = null; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs index 5a10264e5..9e675fdec 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs @@ -52,7 +52,7 @@ namespace Microsoft.PowerShell Thread.CurrentThread.CurrentCulture = NativeCultureResolver.Culture; #if DEBUG - if (args.Length > 0 && !String.IsNullOrEmpty(args[0]) && args[0].Equals("-isswait", StringComparison.OrdinalIgnoreCase)) + if (args.Length > 0 && !string.IsNullOrEmpty(args[0]) && args[0].Equals("-isswait", StringComparison.OrdinalIgnoreCase)) { Console.WriteLine("Attach the debugger to continue..."); while (!System.Diagnostics.Debugger.IsAttached) { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs index 01fb9977c..b6f6766c2 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs @@ -197,7 +197,7 @@ namespace Microsoft.PowerShell // Fifth and Sixth lines: The current operation - if (!String.IsNullOrEmpty(CurrentOperation)) + if (!string.IsNullOrEmpty(CurrentOperation)) { strCollection.Add(" "); RenderFullDescription(this.CurrentOperation, indent, maxWidth, rawUI, strCollection, isFullPlus); @@ -285,7 +285,7 @@ namespace Microsoft.PowerShell // Third line: The current operation - if (!String.IsNullOrEmpty(CurrentOperation)) + if (!string.IsNullOrEmpty(CurrentOperation)) { strCollection.Add( StringUtil.TruncateToBufferCellWidth( @@ -457,7 +457,7 @@ namespace Microsoft.PowerShell ++lines; } - if (!String.IsNullOrEmpty(CurrentOperation)) + if (!string.IsNullOrEmpty(CurrentOperation)) { if (isFullPlus) { @@ -494,7 +494,7 @@ namespace Microsoft.PowerShell // Start with 1 for the Activity, and 1 for the Status. int lines = 2; - if (!String.IsNullOrEmpty(CurrentOperation)) + if (!string.IsNullOrEmpty(CurrentOperation)) { ++lines; } diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs index 77ac4108d..0212bb8d0 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs @@ -1064,7 +1064,7 @@ namespace System.Diagnostics.Eventing.Reader while (true) { string s = Marshal.PtrToStringUni(pointer); - if (String.IsNullOrEmpty(s)) + if (string.IsNullOrEmpty(s)) break; keywordsList.Add(s); //nr of bytes = # chars * 2 + 2 bytes for character '\0'. diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Native.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Native.cs index e7a7d0ec7..a14710aac 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; } diff --git a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs index 832b6e57d..63c10698c 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs @@ -1321,7 +1321,7 @@ namespace Microsoft.PowerShell.Commands { // Verify the parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -2726,7 +2726,7 @@ namespace Microsoft.PowerShell.Commands string noun = null; try { - if (!String.IsNullOrEmpty(helpItemName)) + if (!string.IsNullOrEmpty(helpItemName)) { CmdletInfo.SplitCmdletName(helpItemName, out verb, out noun); } @@ -2735,7 +2735,7 @@ namespace Microsoft.PowerShell.Commands return String.Empty; } - if (String.IsNullOrEmpty(verb) || String.IsNullOrEmpty(noun)) + if (string.IsNullOrEmpty(verb) || string.IsNullOrEmpty(noun)) { return String.Empty; } @@ -2962,7 +2962,7 @@ namespace Microsoft.PowerShell.Commands /// public override string ToString() { - return String.IsNullOrEmpty(_friendlyName) ? + return string.IsNullOrEmpty(_friendlyName) ? _oid : _friendlyName + " (" + _oid + ")"; } diff --git a/src/Microsoft.PowerShell.Security/security/CmsCommands.cs b/src/Microsoft.PowerShell.Security/security/CmsCommands.cs index 6196a29e3..01ebeb166 100644 --- a/src/Microsoft.PowerShell.Security/security/CmsCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/CmsCommands.cs @@ -87,7 +87,7 @@ namespace Microsoft.PowerShell.Commands protected override void BeginProcessing() { // Validate Path - if (!String.IsNullOrEmpty(Path)) + if (!string.IsNullOrEmpty(Path)) { ProviderInfo provider = null; Collection resolvedPaths = GetResolvedProviderPathFromPSPath(Path, out provider); @@ -107,7 +107,7 @@ namespace Microsoft.PowerShell.Commands _resolvedPath = resolvedPaths[0]; } - if (!String.IsNullOrEmpty(LiteralPath)) + if (!string.IsNullOrEmpty(LiteralPath)) { // Validate that the path exists SessionState.InvokeProvider.Item.Get(new string[] { LiteralPath }, false, true); @@ -115,7 +115,7 @@ namespace Microsoft.PowerShell.Commands } // Validate OutFile - if (!String.IsNullOrEmpty(OutFile)) + if (!string.IsNullOrEmpty(OutFile)) { _resolvedOutFile = GetUnresolvedProviderPathFromPSPath(OutFile); } @@ -175,7 +175,7 @@ namespace Microsoft.PowerShell.Commands ThrowTerminatingError(terminatingError); } - if (String.IsNullOrEmpty(_resolvedOutFile)) + if (string.IsNullOrEmpty(_resolvedOutFile)) { WriteObject(encodedContent); } @@ -238,7 +238,7 @@ namespace Microsoft.PowerShell.Commands protected override void BeginProcessing() { // Validate Path - if (!String.IsNullOrEmpty(Path)) + if (!string.IsNullOrEmpty(Path)) { ProviderInfo provider = null; Collection resolvedPaths = GetResolvedProviderPathFromPSPath(Path, out provider); @@ -258,7 +258,7 @@ namespace Microsoft.PowerShell.Commands _resolvedPath = resolvedPaths[0]; } - if (!String.IsNullOrEmpty(LiteralPath)) + if (!string.IsNullOrEmpty(LiteralPath)) { // Validate that the path exists SessionState.InvokeProvider.Item.Get(new string[] { LiteralPath }, false, true); @@ -416,7 +416,7 @@ namespace Microsoft.PowerShell.Commands protected override void BeginProcessing() { // Validate Path - if (!String.IsNullOrEmpty(Path)) + if (!string.IsNullOrEmpty(Path)) { ProviderInfo provider = null; Collection resolvedPaths = GetResolvedProviderPathFromPSPath(Path, out provider); @@ -436,7 +436,7 @@ namespace Microsoft.PowerShell.Commands _resolvedPath = resolvedPaths[0]; } - if (!String.IsNullOrEmpty(LiteralPath)) + if (!string.IsNullOrEmpty(LiteralPath)) { // Validate that the path exists SessionState.InvokeProvider.Item.Get(new string[] { LiteralPath }, false, true); diff --git a/src/Microsoft.WSMan.Management/ConfigProvider.cs b/src/Microsoft.WSMan.Management/ConfigProvider.cs index d673cee31..0a3f2a7bd 100644 --- a/src/Microsoft.WSMan.Management/ConfigProvider.cs +++ b/src/Microsoft.WSMan.Management/ConfigProvider.cs @@ -194,7 +194,7 @@ namespace Microsoft.WSMan.Management return null; } - if (String.IsNullOrEmpty(drive.Root) == false) + if (string.IsNullOrEmpty(drive.Root) == false) { AssertError(helper.GetResourceMsgFromResourcetext("NewDriveRootDoesNotExist"), false); return null; @@ -355,7 +355,7 @@ namespace Microsoft.WSMan.Management string childname = String.Empty; string strPathCheck = String.Empty; - if (path.Length == 0 && String.IsNullOrEmpty(childname)) + if (path.Length == 0 && string.IsNullOrEmpty(childname)) { return true; } @@ -585,7 +585,7 @@ namespace Microsoft.WSMan.Management string childname = string.Empty; - if (path.Length == 0 && String.IsNullOrEmpty(childname)) + if (path.Length == 0 && string.IsNullOrEmpty(childname)) { WriteItemObject(GetItemPSObjectWithTypeName(WSManStringLiterals.rootpath, WSManStringLiterals.ContainerChildValue, null, null, null, WsManElementObjectTypes.WSManConfigElement), WSManStringLiterals.rootpath, true); return; @@ -889,7 +889,7 @@ namespace Microsoft.WSMan.Management string ChildName = string.Empty; - if (path.Length == 0 && String.IsNullOrEmpty(ChildName)) + if (path.Length == 0 && string.IsNullOrEmpty(ChildName)) { AssertError(helper.GetResourceMsgFromResourcetext("SetItemNotSupported"), false); return; @@ -994,7 +994,7 @@ namespace Microsoft.WSMan.Management XmlDocument xmlPlugins = FindResourceValue(sessionobj, uri, null); string currentpluginname = string.Empty; GetPluginNames(xmlPlugins, out objPluginNames, out currentpluginname, path); - if (String.IsNullOrEmpty(currentpluginname)) + if (string.IsNullOrEmpty(currentpluginname)) { if (!this.clearItemIsCalled) { @@ -1048,7 +1048,7 @@ namespace Microsoft.WSMan.Management if (WSManStringLiterals.ConfigRunAsPasswordName.Equals(ChildName, StringComparison.OrdinalIgnoreCase)) { - if(String.IsNullOrEmpty( + if(string.IsNullOrEmpty( pluginConfiguration.GetOneConfiguration( String.Format( CultureInfo.InvariantCulture, @@ -1261,7 +1261,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(pluginConfiguration.ServerSession.Error)) + if (!string.IsNullOrEmpty(pluginConfiguration.ServerSession.Error)) { AssertError(pluginConfiguration.ServerSession.Error, true); } @@ -1316,7 +1316,7 @@ namespace Microsoft.WSMan.Management { if (dynParams.Concatenate) { - if (!String.IsNullOrEmpty(value.ToString())) + if (!string.IsNullOrEmpty(value.ToString())) { // ',' is used as the delimiter in WSMan for TrustedHosts. value = SplitAndUpdateStringUsingDelimiter(sessionobj, uri, ChildName, value.ToString(), ","); @@ -1434,7 +1434,7 @@ namespace Microsoft.WSMan.Management string childname = String.Empty; string strPathCheck = String.Empty; - if (path.Length == 0 && String.IsNullOrEmpty(childname)) + if (path.Length == 0 && string.IsNullOrEmpty(childname)) { return true; } @@ -1779,7 +1779,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2079,7 +2079,7 @@ namespace Microsoft.WSMan.Management WSManProviderNewItemPluginParameters niParams = DynamicParameters as WSManProviderNewItemPluginParameters; if (niParams != null) { - if (String.IsNullOrEmpty(niParams.File)) + if (string.IsNullOrEmpty(niParams.File)) { mshObj.Properties.Add(new PSNoteProperty("Name", niParams.Plugin)); mshObj.Properties.Add(new PSNoteProperty("Filename", niParams.FileName)); @@ -2285,7 +2285,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2336,7 +2336,7 @@ namespace Microsoft.WSMan.Management mshObject = new PSObject(element); } - if (!String.IsNullOrEmpty(ExtendedTypeName)) + if (!string.IsNullOrEmpty(ExtendedTypeName)) { StringBuilder types = new StringBuilder(string.Empty); if (mshObject != null) @@ -2716,7 +2716,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2741,7 +2741,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2790,7 +2790,7 @@ namespace Microsoft.WSMan.Management Marshal.ReleaseComObject(value); - if (!String.IsNullOrEmpty(strXmlValue)) + if (!string.IsNullOrEmpty(strXmlValue)) { xmlEnumResources = new XmlDocument(); strXmlValue = "" + strXmlValue + ""; @@ -2801,7 +2801,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2837,7 +2837,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2863,7 +2863,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) + if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error)) { AssertError(((IWSManSession)sessionobj).Error, true); } @@ -2924,7 +2924,7 @@ namespace Microsoft.WSMan.Management valuexml = valuexml + ((IWSManEnumerator)value).ReadItem(); } - if ((valuexml != string.Empty) && !(String.IsNullOrEmpty(valuexml))) + if ((valuexml != string.Empty) && !(string.IsNullOrEmpty(valuexml))) { valuexml = "" + valuexml + ""; } @@ -3030,7 +3030,7 @@ namespace Microsoft.WSMan.Management result = true; } } - else if (!String.IsNullOrEmpty(value)) + else if (!string.IsNullOrEmpty(value)) { foreach (string key in pkeys) { @@ -3117,7 +3117,7 @@ namespace Microsoft.WSMan.Management } } - if (!String.IsNullOrEmpty(ExtendedTypeName)) + if (!string.IsNullOrEmpty(ExtendedTypeName)) { StringBuilder types = new StringBuilder(string.Empty); if (mshObject != null) @@ -3183,7 +3183,7 @@ namespace Microsoft.WSMan.Management existingvalue = mshObject.Properties[childname].Value.ToString(); } - if (!String.IsNullOrEmpty(existingvalue)) + if (!string.IsNullOrEmpty(existingvalue)) { string[] existingsplitvalues = existingvalue.Split(new string[] { Delimiter }, StringSplitOptions.None); string[] newvalues = value.Split(new string[] { Delimiter }, StringSplitOptions.None); @@ -3450,7 +3450,7 @@ namespace Microsoft.WSMan.Management //Get the wsman host name to find the session object string host = GetHostName(path); - if (String.IsNullOrEmpty(host)) + if (string.IsNullOrEmpty(host)) { throw new InvalidOperationException("InvalidPath"); } @@ -3627,7 +3627,7 @@ namespace Microsoft.WSMan.Management result = WSManStringLiterals.containerListener; else { - if (!String.IsNullOrEmpty(hostname)) + if (!string.IsNullOrEmpty(hostname)) { Dictionary SessionObjCache = WSManHelper.GetSessionObjCache(); if (ChildName.Equals(hostname, StringComparison.OrdinalIgnoreCase)) @@ -3903,7 +3903,7 @@ namespace Microsoft.WSMan.Management //Get the wsman host name to find the session object string host = GetHostName(path); - if (String.IsNullOrEmpty(host)) + if (string.IsNullOrEmpty(host)) { return false; @@ -3922,7 +3922,7 @@ namespace Microsoft.WSMan.Management //Get URI to pass to WsMan Automation API string uri = NormalizePath(path, host); - if (String.IsNullOrEmpty(uri)) + if (string.IsNullOrEmpty(uri)) { return false; } @@ -3951,7 +3951,7 @@ namespace Microsoft.WSMan.Management XmlDocument outxml = FindResourceValue(sessionobj, uri, null); string currentpluginname = String.Empty; GetPluginNames(outxml, out objPluginNames, out currentpluginname, path); - if (String.IsNullOrEmpty(currentpluginname)) + if (string.IsNullOrEmpty(currentpluginname)) { return false; } @@ -4210,7 +4210,7 @@ namespace Microsoft.WSMan.Management //Get the wsman host name to find the session object string host = GetHostName(path); - if (String.IsNullOrEmpty(host)) + if (string.IsNullOrEmpty(host)) { throw new InvalidOperationException("InvalidPath"); } @@ -4880,7 +4880,7 @@ namespace Microsoft.WSMan.Management XmlAttributeCollection attributecol = nodelistPlugin.Item(0).Attributes; XmlNode runAsUserNode = attributecol.GetNamedItem(WSManStringLiterals.ConfigRunAsUserName); - bool runAsUserPresent = runAsUserNode != null && !String.IsNullOrEmpty(runAsUserNode.Value); + bool runAsUserPresent = runAsUserNode != null && !string.IsNullOrEmpty(runAsUserNode.Value); for (int i = 0; i <= attributecol.Count - 1; i++) { diff --git a/src/Microsoft.WSMan.Management/CredSSP.cs b/src/Microsoft.WSMan.Management/CredSSP.cs index 6aed2692a..68e82c9d0 100644 --- a/src/Microsoft.WSMan.Management/CredSSP.cs +++ b/src/Microsoft.WSMan.Management/CredSSP.cs @@ -165,7 +165,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { helper.AssertError(m_SessionObj.Error, true, null); } @@ -214,7 +214,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { helper.AssertError(m_SessionObj.Error, true, null); } @@ -553,7 +553,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { helper.AssertError(m_SessionObj.Error, true, delegatecomputer); } @@ -613,7 +613,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { helper.AssertError(m_SessionObj.Error, true, delegatecomputer); } @@ -894,7 +894,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { helper.AssertError(m_SessionObj.Error, true, null); } diff --git a/src/Microsoft.WSMan.Management/CurrentConfigurations.cs b/src/Microsoft.WSMan.Management/CurrentConfigurations.cs index aeb78f97b..aa41752d6 100644 --- a/src/Microsoft.WSMan.Management/CurrentConfigurations.cs +++ b/src/Microsoft.WSMan.Management/CurrentConfigurations.cs @@ -79,7 +79,7 @@ namespace Microsoft.WSMan.Management /// False, if operation failed. public bool RefreshCurrentConfiguration(string responseOfGet) { - if (String.IsNullOrEmpty(responseOfGet)) + if (string.IsNullOrEmpty(responseOfGet)) { throw new ArgumentNullException("responseOfGet"); } @@ -90,7 +90,7 @@ namespace Microsoft.WSMan.Management this.nameSpaceManger = new XmlNamespaceManager(this.rootDocument.NameTable); this.nameSpaceManger.AddNamespace(CurrentConfigurations.DefaultNameSpacePrefix, this.documentElement.NamespaceURI); - return String.IsNullOrEmpty(this.serverSession.Error); + return string.IsNullOrEmpty(this.serverSession.Error); } /// @@ -101,7 +101,7 @@ namespace Microsoft.WSMan.Management /// False, if operation is not succesful. public void PutConfigurationOnServer(string resourceUri) { - if (String.IsNullOrEmpty(resourceUri)) + if (string.IsNullOrEmpty(resourceUri)) { throw new ArgumentNullException("resourceUri"); } @@ -155,7 +155,7 @@ namespace Microsoft.WSMan.Management throw new ArgumentNullException("pathToNodeFromRoot"); } - if (String.IsNullOrEmpty(configurationName)) + if (string.IsNullOrEmpty(configurationName)) { throw new ArgumentNullException("configurationName"); } diff --git a/src/Microsoft.WSMan.Management/InvokeWSManAction.cs b/src/Microsoft.WSMan.Management/InvokeWSManAction.cs index 5c0cc1e65..ed7c07916 100644 --- a/src/Microsoft.WSMan.Management/InvokeWSManAction.cs +++ b/src/Microsoft.WSMan.Management/InvokeWSManAction.cs @@ -289,12 +289,12 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_wsmanObject.Error)) + if (!string.IsNullOrEmpty(m_wsmanObject.Error)) { helper.AssertError(m_wsmanObject.Error, true, resourceuri); } - if (!String.IsNullOrEmpty(m_session.Error)) + if (!string.IsNullOrEmpty(m_session.Error)) { helper.AssertError(m_session.Error, true, resourceuri); } diff --git a/src/Microsoft.WSMan.Management/PingWSMan.cs b/src/Microsoft.WSMan.Management/PingWSMan.cs index d456cc847..a360bbfb4 100644 --- a/src/Microsoft.WSMan.Management/PingWSMan.cs +++ b/src/Microsoft.WSMan.Management/PingWSMan.cs @@ -156,7 +156,7 @@ namespace Microsoft.WSMan.Management { try { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { XmlDocument ErrorDoc = new XmlDocument(); ErrorDoc.LoadXml(m_SessionObj.Error); diff --git a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs index da8e59aa0..3c21ac6a7 100644 --- a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs +++ b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs @@ -253,7 +253,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_SessionObj.Error)) + if (!string.IsNullOrEmpty(m_SessionObj.Error)) { helper.AssertError(m_SessionObj.Error, true, null); } diff --git a/src/Microsoft.WSMan.Management/WSManInstance.cs b/src/Microsoft.WSMan.Management/WSManInstance.cs index 867ce7dae..d464da8aa 100644 --- a/src/Microsoft.WSMan.Management/WSManInstance.cs +++ b/src/Microsoft.WSMan.Management/WSManInstance.cs @@ -580,12 +580,12 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_wsmanObject.Error)) + if (!string.IsNullOrEmpty(m_wsmanObject.Error)) { helper.AssertError(m_wsmanObject.Error, true, resourceuri); } - if (!String.IsNullOrEmpty(m_session.Error)) + if (!string.IsNullOrEmpty(m_session.Error)) { helper.AssertError(m_session.Error, true, resourceuri); } @@ -956,12 +956,12 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_wsmanObject.Error)) + if (!string.IsNullOrEmpty(m_wsmanObject.Error)) { helper.AssertError(m_wsmanObject.Error, true, resourceuri); } - if (!String.IsNullOrEmpty(m_session.Error)) + if (!string.IsNullOrEmpty(m_session.Error)) { helper.AssertError(m_session.Error, true, resourceuri); } @@ -1237,12 +1237,12 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_session.Error)) + if (!string.IsNullOrEmpty(m_session.Error)) { helper.AssertError(m_session.Error, true, resourceuri); } - if (!String.IsNullOrEmpty(m_wsmanObject.Error)) + if (!string.IsNullOrEmpty(m_wsmanObject.Error)) { helper.AssertError(m_wsmanObject.Error, true, resourceuri); } @@ -1545,12 +1545,12 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_wsmanObject.Error)) + if (!string.IsNullOrEmpty(m_wsmanObject.Error)) { helper.AssertError(m_wsmanObject.Error, true, resourceuri); } - if (!String.IsNullOrEmpty(m_session.Error)) + if (!string.IsNullOrEmpty(m_session.Error)) { helper.AssertError(m_session.Error, true, resourceuri); } diff --git a/src/Microsoft.WSMan.Management/WsManHelper.cs b/src/Microsoft.WSMan.Management/WsManHelper.cs index 0cd3bada0..fbc90c29e 100644 --- a/src/Microsoft.WSMan.Management/WsManHelper.cs +++ b/src/Microsoft.WSMan.Management/WsManHelper.cs @@ -182,7 +182,7 @@ namespace Microsoft.WSMan.Management throw new ArgumentNullException("resourceManager"); } - if (String.IsNullOrEmpty(resourceName)) + if (string.IsNullOrEmpty(resourceName)) { throw new ArgumentNullException("resourceName"); } @@ -703,7 +703,7 @@ namespace Microsoft.WSMan.Management if (credential.UserName != null) { nwCredential = credential.GetNetworkCredential(); - if (String.IsNullOrEmpty(nwCredential.Domain)) + if (string.IsNullOrEmpty(nwCredential.Domain)) { if ( authentication.Equals(AuthenticationMechanism.Digest) || authentication.Equals(AuthenticationMechanism.Basic) ) { @@ -987,7 +987,7 @@ namespace Microsoft.WSMan.Management } finally { - if (!String.IsNullOrEmpty(m_wsmanObject.Error)) + if (!string.IsNullOrEmpty(m_wsmanObject.Error)) { AssertError(m_wsmanObject.Error, true, computername); } diff --git a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs index 70734a37f..1811a2a1f 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs @@ -314,13 +314,13 @@ namespace System.Management.Automation bool assemblyFound = false; char dirSeparator = IO.Path.DirectorySeparatorChar; - if (String.IsNullOrEmpty(_winDir)) + if (string.IsNullOrEmpty(_winDir)) { //cache value of '_winDir' folder in member variable. _winDir = Environment.GetEnvironmentVariable("winDir"); } - if (String.IsNullOrEmpty(_gacPathMSIL)) + if (string.IsNullOrEmpty(_gacPathMSIL)) { //cache value of '_gacPathMSIL' folder in member variable. _gacPathMSIL = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_MSIL"; @@ -334,7 +334,7 @@ namespace System.Management.Automation if (Environment.Is64BitProcess) { - if (String.IsNullOrEmpty(_gacPath64)) + if (string.IsNullOrEmpty(_gacPath64)) { //cache value of '_gacPath64' folder in member variable. _gacPath64 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_64"; @@ -344,7 +344,7 @@ namespace System.Management.Automation } else { - if (String.IsNullOrEmpty(_gacPath32)) + if (string.IsNullOrEmpty(_gacPath32)) { //cache value of '_gacPath32' folder in member variable. _gacPath32 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_32"; @@ -373,12 +373,12 @@ namespace System.Management.Automation //Enumerate all directories, sort by name and select the last. This selects the latest version. var chosenVersionDirectory = Directory.GetDirectories(tempAssemblyDirPath).OrderBy(d => d).LastOrDefault(); - if (!String.IsNullOrEmpty(chosenVersionDirectory)) + if (!string.IsNullOrEmpty(chosenVersionDirectory)) { //Select first or default as the directory will contain only one assembly. If nothing then default is null; var foundAssemblyPath = Directory.GetFiles(chosenVersionDirectory, $"{assemblyName.Name}*").FirstOrDefault(); - if (!String.IsNullOrEmpty(foundAssemblyPath)) + if (!string.IsNullOrEmpty(foundAssemblyPath)) { AssemblyName asmNameFound = AssemblyLoadContext.GetAssemblyName(foundAssemblyPath); if (IsAssemblyMatching(assemblyName, asmNameFound)) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 06204e664..4a972a857 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -255,7 +255,7 @@ namespace System.Management.Automation { case Platform.XDG_Type.CONFIG: //the user has set XDG_CONFIG_HOME corresponding to profile path - if (String.IsNullOrEmpty(xdgconfighome)) + if (string.IsNullOrEmpty(xdgconfighome)) { //xdg values have not been set return xdgConfigHomeDefault; @@ -268,7 +268,7 @@ namespace System.Management.Automation case Platform.XDG_Type.DATA: //the user has set XDG_DATA_HOME corresponding to module path - if (String.IsNullOrEmpty(xdgdatahome)) + if (string.IsNullOrEmpty(xdgdatahome)) { // create the xdg folder if needed if (!Directory.Exists(xdgDataHomeDefault)) @@ -293,7 +293,7 @@ namespace System.Management.Automation case Platform.XDG_Type.USER_MODULES: //the user has set XDG_DATA_HOME corresponding to module path - if (String.IsNullOrEmpty(xdgdatahome)) + if (string.IsNullOrEmpty(xdgdatahome)) { //xdg values have not been set if (!Directory.Exists(xdgModuleDefault)) //module folder not always guaranteed to exist @@ -321,7 +321,7 @@ namespace System.Management.Automation case Platform.XDG_Type.CACHE: //the user has set XDG_CACHE_HOME - if (String.IsNullOrEmpty(xdgcachehome)) + if (string.IsNullOrEmpty(xdgcachehome)) { //xdg values have not been set if (!Directory.Exists(xdgCacheDefault)) //module folder not always guaranteed to exist diff --git a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs index 205fa6e1d..8c824ad24 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs @@ -561,7 +561,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - if (!String.IsNullOrEmpty(word.Delim)) + if (!string.IsNullOrEmpty(word.Delim)) { wordToAdd += word.Delim; } diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs index 784020cf4..08fe9688a 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs @@ -335,7 +335,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal string GetMandatoryInnerText(XmlNode n) { - if (String.IsNullOrEmpty(n.InnerText)) + if (string.IsNullOrEmpty(n.InnerText)) { this.ReportEmptyNode(n); return null; @@ -346,7 +346,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal string GetMandatoryAttributeValue(XmlAttribute a) { - if (String.IsNullOrEmpty(a.Value)) + if (string.IsNullOrEmpty(a.Value)) { this.ReportEmptyAttribute(a); return null; diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs index e63c71fef..e23089406 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs @@ -634,7 +634,7 @@ namespace System.Management.Automation /// public ExtendedTypeDefinition(string typeName, IEnumerable viewDefinitions) : this() { - if (String.IsNullOrEmpty(typeName)) + if (string.IsNullOrEmpty(typeName)) throw PSTraceSource.NewArgumentNullException("typeName"); if (viewDefinitions == null) throw PSTraceSource.NewArgumentNullException("viewDefinitions"); @@ -652,7 +652,7 @@ namespace System.Management.Automation /// public ExtendedTypeDefinition(string typeName) : this() { - if (String.IsNullOrEmpty(typeName)) + if (string.IsNullOrEmpty(typeName)) throw PSTraceSource.NewArgumentNullException("typeName"); TypeNames.Add(typeName); @@ -690,7 +690,7 @@ namespace System.Management.Automation /// public FormatViewDefinition(string name, PSControl control) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) throw PSTraceSource.NewArgumentNullException("name"); if (control == null) throw PSTraceSource.NewArgumentNullException("control"); @@ -797,7 +797,7 @@ namespace System.Management.Automation /// Public constructor for DisplayEntry public DisplayEntry(string value, DisplayEntryValueType type) { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) if (value == null || type == DisplayEntryValueType.Property) throw PSTraceSource.NewArgumentNullException("value"); @@ -816,7 +816,7 @@ namespace System.Management.Automation Value = expression.expressionValue; ValueType = expression.isScriptBlock ? DisplayEntryValueType.ScriptBlock : DisplayEntryValueType.Property; - if (String.IsNullOrEmpty(Value)) + if (string.IsNullOrEmpty(Value)) if (Value == null || ValueType == DisplayEntryValueType.Property) throw PSTraceSource.NewArgumentNullException("value"); } diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs index f0fe63927..65a237618 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs @@ -596,7 +596,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // Label --- Label cardinality 0..1 // Width --- Width cardinality 0..1 // Alignment --- Alignment cardinality 0..1 - if (!String.IsNullOrEmpty(header.Label)) + if (!string.IsNullOrEmpty(header.Label)) { TextToken tt = new TextToken(); tt.text = header.Label; @@ -754,7 +754,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { foreach (string type in selectedBy) { - if (String.IsNullOrEmpty(type)) + if (string.IsNullOrEmpty(type)) return null; TypeReference tr = new TypeReference { name = type }; appliesTo.referenceList.Add(tr); @@ -898,7 +898,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format lvid.formatTokenList.Add(fpt); } - if (!String.IsNullOrEmpty(listItem.Label)) + if (!string.IsNullOrEmpty(listItem.Label)) { TextToken tt = new TextToken(); tt.text = listItem.Label; diff --git a/src/System.Management.Automation/engine/ApplicationInfo.cs b/src/System.Management.Automation/engine/ApplicationInfo.cs index c67724422..2d8469d09 100644 --- a/src/System.Management.Automation/engine/ApplicationInfo.cs +++ b/src/System.Management.Automation/engine/ApplicationInfo.cs @@ -37,7 +37,7 @@ namespace System.Management.Automation /// internal ApplicationInfo(string name, string path, ExecutionContext context) : base(name, CommandTypes.Application) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } diff --git a/src/System.Management.Automation/engine/Attributes.cs b/src/System.Management.Automation/engine/Attributes.cs index 14238f496..041e3af29 100644 --- a/src/System.Management.Automation/engine/Attributes.cs +++ b/src/System.Management.Automation/engine/Attributes.cs @@ -690,7 +690,7 @@ namespace System.Management.Automation set { _parameterSetName = value; - if (String.IsNullOrEmpty(_parameterSetName)) + if (string.IsNullOrEmpty(_parameterSetName)) { _parameterSetName = ParameterAttribute.AllParameterSets; } @@ -1354,7 +1354,7 @@ namespace System.Management.Automation Match match = regex.Match(objectString); if (!match.Success) { - var errorMessageFormat = String.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidatePatternFailure : ErrorMessage; + var errorMessageFormat = string.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidatePatternFailure : ErrorMessage; throw new ValidationMetadataException("ValidatePatternFailure", null, errorMessageFormat, objectString, RegexPattern); @@ -1368,7 +1368,7 @@ namespace System.Management.Automation /// For invalid arguments. public ValidatePatternAttribute(string regexPattern) { - if (String.IsNullOrEmpty(regexPattern)) + if (string.IsNullOrEmpty(regexPattern)) { throw PSTraceSource.NewArgumentException("regexPattern"); } @@ -1425,7 +1425,7 @@ namespace System.Management.Automation if (!LanguagePrimitives.IsTrue(result)) { - var errorMessageFormat = String.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateScriptFailure : ErrorMessage; + var errorMessageFormat = string.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateScriptFailure : ErrorMessage; throw new ValidationMetadataException("ValidateScriptFailure", null, errorMessageFormat, element, ScriptBlock); @@ -1712,7 +1712,7 @@ namespace System.Management.Automation } } - var errorMessageFormat = String.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateSetFailure : ErrorMessage; + var errorMessageFormat = string.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateSetFailure : ErrorMessage; throw new ValidationMetadataException("ValidateSetFailure", null, errorMessageFormat, element.ToString(), SetAsString()); @@ -2082,7 +2082,7 @@ namespace System.Management.Automation } else if (arguments is string str) { - if (String.IsNullOrEmpty(str)) + if (string.IsNullOrEmpty(str)) { throw new ValidationMetadataException( "ArgumentIsEmpty", @@ -2112,7 +2112,7 @@ namespace System.Management.Automation if (element is string elementAsString) { - if (String.IsNullOrEmpty(elementAsString)) + if (string.IsNullOrEmpty(elementAsString)) { throw new ValidationMetadataException( "ArgumentCollectionContainsEmpty", diff --git a/src/System.Management.Automation/engine/CmdletInfo.cs b/src/System.Management.Automation/engine/CmdletInfo.cs index e1c1dc1d2..d15dfe2e8 100644 --- a/src/System.Management.Automation/engine/CmdletInfo.cs +++ b/src/System.Management.Automation/engine/CmdletInfo.cs @@ -42,7 +42,7 @@ namespace System.Management.Automation ExecutionContext context) : base(name, CommandTypes.Cmdlet, context) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -103,7 +103,7 @@ namespace System.Management.Automation public CmdletInfo(string name, Type implementingType) : base(name, CommandTypes.Cmdlet, null) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentNullException("name"); } @@ -462,7 +462,7 @@ namespace System.Management.Automation { System.Diagnostics.Debug.Assert(cmdletName != null, "cmdletName != null"); string result = cmdletName; - if (!String.IsNullOrEmpty(moduleName)) + if (!string.IsNullOrEmpty(moduleName)) { result = moduleName + '\\' + result; } diff --git a/src/System.Management.Automation/engine/CmdletParameterBinderController.cs b/src/System.Management.Automation/engine/CmdletParameterBinderController.cs index 570de169a..cef43bed3 100644 --- a/src/System.Management.Automation/engine/CmdletParameterBinderController.cs +++ b/src/System.Management.Automation/engine/CmdletParameterBinderController.cs @@ -2818,7 +2818,7 @@ namespace System.Management.Automation if (currentParameterSetActive == 1) { string parameterSetName = bindableParameters.GetParameterSetName(currentParameterSet); - if (!String.IsNullOrEmpty(parameterSetName)) + if (!string.IsNullOrEmpty(parameterSetName)) { ParameterBinderBase.bindingTracer.WriteLine("Remaining valid parameter set: {0}", parameterSetName); } diff --git a/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs index 04a3e2f15..3276b0abc 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs @@ -34,7 +34,7 @@ namespace System.Management.Automation.ComInterop // yields a runtime exception in the ToString() function. DefaultValue = DBNull.Value; - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { // This is a parameter, not a return value IsOut = (elemDesc.desc.paramdesc.wParamFlags & PARAMFLAG.PARAMFLAG_FOUT) != 0; diff --git a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs index f8d258495..c012fc081 100644 --- a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs +++ b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs @@ -106,7 +106,7 @@ namespace System.Management.Automation.ComInterop typeName = ctd.TypeName; } - if (String.IsNullOrEmpty(typeName)) + if (string.IsNullOrEmpty(typeName)) { typeName = "IDispatch"; } diff --git a/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs b/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs index 857f80804..edcdd4d35 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs @@ -886,7 +886,7 @@ namespace System.Management.Automation // Determine if we need to quote the paths we parse lastWord = lastWord ?? string.Empty; - bool isLastWordEmpty = String.IsNullOrEmpty(lastWord); + bool isLastWordEmpty = string.IsNullOrEmpty(lastWord); bool lastCharIsStar = !isLastWordEmpty && lastWord.EndsWith("*", StringComparison.Ordinal); bool containsGlobChars = WildcardPattern.ContainsWildcardCharacters(lastWord); @@ -1077,7 +1077,7 @@ namespace System.Management.Automation private static List PSv2FindMatches(PowerShellExecutionHelper helper, string path, bool shouldFullyQualifyPaths) { - Diagnostics.Assert(!String.IsNullOrEmpty(path), "path should have a value"); + Diagnostics.Assert(!string.IsNullOrEmpty(path), "path should have a value"); var result = new List(); Exception exceptionThrown; diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs index 87d6ff428..4dc2fc064 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs @@ -954,7 +954,7 @@ namespace System.Management.Automation private static string GetFirstLineSubString(string stringToComplete, out bool hasNewLine) { hasNewLine = false; - if (!String.IsNullOrEmpty(stringToComplete)) + if (!string.IsNullOrEmpty(stringToComplete)) { var index = stringToComplete.IndexOfAny(Utils.Separators.CrLf); if (index >= 0) @@ -1146,7 +1146,7 @@ namespace System.Management.Automation dynamicKeywordAst != keywordAst && !String.Equals(dynamicKeywordAst.Keyword.Keyword, @"Node", StringComparison.OrdinalIgnoreCase)) { - if (!String.IsNullOrEmpty(dynamicKeywordAst.ElementName)) + if (!string.IsNullOrEmpty(dynamicKeywordAst.ElementName)) { StringBuilder sb = new StringBuilder("[", 50); sb.Append(dynamicKeywordAst.Keyword.Keyword); diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index 0a2b9facf..58b492016 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -273,7 +273,7 @@ namespace System.Management.Automation // --> command 'Get-PowerShellFoo' in the global session state (prefixed commandInfo) // command 'Get-Foo' in the module session state (un-prefixed commandInfo) // in that case, we should not add the module name qualification because it doesn't work - if (String.IsNullOrEmpty(commandInfo.Prefix) || !ModuleCmdletBase.IsPrefixedCommand(commandInfo)) + if (string.IsNullOrEmpty(commandInfo.Prefix) || !ModuleCmdletBase.IsPrefixedCommand(commandInfo)) { name = commandInfo.ModuleName + "\\" + commandInfo.Name; } @@ -323,9 +323,9 @@ namespace System.Management.Automation if (!includeModulePrefix) { var commandInfo = commandList[0] as CommandInfo; - if (commandInfo != null && !String.IsNullOrEmpty(commandInfo.Prefix)) + if (commandInfo != null && !string.IsNullOrEmpty(commandInfo.Prefix)) { - Diagnostics.Assert(!String.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string"); + Diagnostics.Assert(!string.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string"); if (!ModuleCmdletBase.IsPrefixedCommand(commandInfo)) { completionName = commandInfo.ModuleName + "\\" + completionName; @@ -364,9 +364,9 @@ namespace System.Management.Automation if (!includeModulePrefix) { var commandInfo = keyValuePair.Value as CommandInfo; - if (commandInfo != null && !String.IsNullOrEmpty(commandInfo.Prefix)) + if (commandInfo != null && !string.IsNullOrEmpty(commandInfo.Prefix)) { - Diagnostics.Assert(!String.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string"); + Diagnostics.Assert(!string.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string"); if (!ModuleCmdletBase.IsPrefixedCommand(commandInfo)) { completionName = commandInfo.ModuleName + "\\" + completionName; @@ -3648,7 +3648,7 @@ namespace System.Management.Automation { if (paramName.Equals("ItemType", StringComparison.OrdinalIgnoreCase)) { - if (!String.IsNullOrEmpty(context.WordToComplete)) + if (!string.IsNullOrEmpty(context.WordToComplete)) { WildcardPattern patternEvaluator = WildcardPattern.Get(context.WordToComplete + "*", WildcardOptions.IgnoreCase); @@ -4596,7 +4596,7 @@ namespace System.Management.Automation } } - if (String.IsNullOrEmpty(userPath)) + if (string.IsNullOrEmpty(userPath)) { Diagnostics.Assert(false, "Found a variable source but it was an unknown AST type."); } @@ -6099,7 +6099,7 @@ namespace System.Management.Automation { case TokenKind.Switch: - Diagnostics.Assert(!String.IsNullOrEmpty(wordToComplete) && wordToComplete[0].IsDash(), "the word to complete should start with '-'"); + Diagnostics.Assert(!string.IsNullOrEmpty(wordToComplete) && wordToComplete[0].IsDash(), "the word to complete should start with '-'"); wordToComplete = wordToComplete.Substring(1); bool withColon = wordToComplete.EndsWith(":", StringComparison.Ordinal); wordToComplete = withColon ? wordToComplete.Remove(wordToComplete.Length - 1) : wordToComplete; diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs index 67f7c131e..15647ed32 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionResult.cs @@ -168,12 +168,12 @@ namespace System.Management.Automation /// The text for the tooltip with details to be displayed about the object. public CompletionResult(string completionText, string listItemText, CompletionResultType resultType, string toolTip) { - if (String.IsNullOrEmpty(completionText)) + if (string.IsNullOrEmpty(completionText)) { throw PSTraceSource.NewArgumentNullException("completionText"); } - if (String.IsNullOrEmpty(listItemText)) + if (string.IsNullOrEmpty(listItemText)) { throw PSTraceSource.NewArgumentNullException("listItemText"); } @@ -183,7 +183,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentOutOfRangeException("resultType", resultType); } - if (String.IsNullOrEmpty(toolTip)) + if (string.IsNullOrEmpty(toolTip)) { throw PSTraceSource.NewArgumentNullException("toolTip"); } diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index 414837983..e012c0f02 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -198,7 +198,7 @@ namespace System.Management.Automation /// internal CmdletInfo AddCmdletInfoToCache(string name, CmdletInfo newCmdletInfo, bool isGlobal) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -348,7 +348,7 @@ namespace System.Management.Automation // If there were no PSSnapins required but there is a shellID required, then we need // to error - if (!String.IsNullOrEmpty(scriptInfo.RequiresApplicationID)) + if (!string.IsNullOrEmpty(scriptInfo.RequiresApplicationID)) { ScriptRequiresException sre = new ScriptRequiresException( @@ -771,7 +771,7 @@ namespace System.Management.Automation CommandOrigin commandOrigin, ExecutionContext context) { - if (String.IsNullOrEmpty(commandName)) + if (string.IsNullOrEmpty(commandName)) { return null; } @@ -1207,7 +1207,7 @@ namespace System.Management.Automation } } - if (String.IsNullOrEmpty(moduleName) || String.IsNullOrEmpty(moduleCommandName) || moduleName.EndsWith(".", StringComparison.Ordinal)) + if (string.IsNullOrEmpty(moduleName) || string.IsNullOrEmpty(moduleCommandName) || moduleName.EndsWith(".", StringComparison.Ordinal)) return null; bool etwEnabled = CommandDiscoveryEventSource.Log.IsEnabled(); @@ -1482,7 +1482,7 @@ namespace System.Management.Automation /// internal IEnumerator GetCmdletInfo(string cmdletName, bool searchAllScopes) { - Dbg.Assert(!String.IsNullOrEmpty(cmdletName), "Caller should verify the cmdletName"); + Dbg.Assert(!string.IsNullOrEmpty(cmdletName), "Caller should verify the cmdletName"); PSSnapinQualifiedName commandName = PSSnapinQualifiedName.GetInstance(cmdletName); @@ -1507,7 +1507,7 @@ namespace System.Management.Automation foreach (var cmdletInfo in cmdlets) { - if (!String.IsNullOrEmpty(commandName.PSSnapInName)) + if (!string.IsNullOrEmpty(commandName.PSSnapInName)) { if (String.Equals(cmdletInfo.ModuleName, commandName.PSSnapInName, StringComparison.OrdinalIgnoreCase)) { @@ -1573,7 +1573,7 @@ namespace System.Management.Automation // check the environment variable string psEnvironmentVariable = Environment.GetEnvironmentVariable(environmentVariable); - if (!String.IsNullOrEmpty(psEnvironmentVariable)) + if (!string.IsNullOrEmpty(psEnvironmentVariable)) { return LanguagePrimitives.ConvertTo(psEnvironmentVariable); } @@ -1693,7 +1693,7 @@ namespace System.Management.Automation for (int index = 0; index < this.Count; ++index) { string path = this[index]; - if (!String.IsNullOrEmpty(path) && + if (!string.IsNullOrEmpty(path) && path.StartsWith(".", StringComparison.Ordinal)) { result.Add(index); @@ -1718,7 +1718,7 @@ namespace System.Management.Automation /// public new int IndexOf(string item) { - if (String.IsNullOrEmpty(item)) + if (string.IsNullOrEmpty(item)) { throw PSTraceSource.NewArgumentException("item"); } diff --git a/src/System.Management.Automation/engine/CommandInfo.cs b/src/System.Management.Automation/engine/CommandInfo.cs index bb28681fe..1589e53d1 100644 --- a/src/System.Management.Automation/engine/CommandInfo.cs +++ b/src/System.Management.Automation/engine/CommandInfo.cs @@ -289,7 +289,7 @@ namespace System.Management.Automation /// internal void Rename(string newName) { - if (String.IsNullOrEmpty(newName)) + if (string.IsNullOrEmpty(newName)) { throw new ArgumentNullException("newName"); } diff --git a/src/System.Management.Automation/engine/CommandMetadata.cs b/src/System.Management.Automation/engine/CommandMetadata.cs index d6360521a..462b9420c 100644 --- a/src/System.Management.Automation/engine/CommandMetadata.cs +++ b/src/System.Management.Automation/engine/CommandMetadata.cs @@ -312,7 +312,7 @@ namespace System.Management.Automation /// internal static CommandMetadata Get(string commandName, Type cmdletType, ExecutionContext context) { - if (String.IsNullOrEmpty(commandName)) + if (string.IsNullOrEmpty(commandName)) { throw PSTraceSource.NewArgumentException("commandName"); } @@ -366,7 +366,7 @@ namespace System.Management.Automation /// internal CommandMetadata(string commandName, Type cmdletType, ExecutionContext context) { - if (String.IsNullOrEmpty(commandName)) + if (string.IsNullOrEmpty(commandName)) { throw PSTraceSource.NewArgumentException("commandName"); } diff --git a/src/System.Management.Automation/engine/CommandPathSearch.cs b/src/System.Management.Automation/engine/CommandPathSearch.cs index 39a918d03..bde1dfbdc 100644 --- a/src/System.Management.Automation/engine/CommandPathSearch.cs +++ b/src/System.Management.Automation/engine/CommandPathSearch.cs @@ -150,7 +150,7 @@ namespace System.Management.Automation // Note, if the directory resolves to multiple paths, only the first is used. - if (!String.IsNullOrEmpty(resolvedPath)) + if (!string.IsNullOrEmpty(resolvedPath)) { CommandDiscovery.discoveryTracer.TraceError( "The relative path resolved to: {0}", diff --git a/src/System.Management.Automation/engine/CommandProcessorBase.cs b/src/System.Management.Automation/engine/CommandProcessorBase.cs index 8b98c796d..8f52b953f 100644 --- a/src/System.Management.Automation/engine/CommandProcessorBase.cs +++ b/src/System.Management.Automation/engine/CommandProcessorBase.cs @@ -408,7 +408,7 @@ namespace System.Management.Automation private void HandleObsoleteCommand(ObsoleteAttribute obsoleteAttr) { string commandName = - String.IsNullOrEmpty(CommandInfo.Name) + string.IsNullOrEmpty(CommandInfo.Name) ? "script block" : String.Format(System.Globalization.CultureInfo.InvariantCulture, CommandBaseStrings.ObsoleteCommand, CommandInfo.Name); diff --git a/src/System.Management.Automation/engine/CommandSearcher.cs b/src/System.Management.Automation/engine/CommandSearcher.cs index 88015960b..083fb300d 100644 --- a/src/System.Management.Automation/engine/CommandSearcher.cs +++ b/src/System.Management.Automation/engine/CommandSearcher.cs @@ -378,7 +378,7 @@ namespace System.Management.Automation CommandInfo currentMatch = null; string path = DoPowerShellRelativePathLookup(); - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { currentMatch = GetInfoFromPath(path); } @@ -1178,7 +1178,7 @@ namespace System.Management.Automation internal Collection ConstructSearchPatternsFromName(string name, bool commandDiscovery = false) { Dbg.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "Caller should verify name"); Collection result = new Collection(); @@ -1188,7 +1188,7 @@ namespace System.Management.Automation bool commandNameAddedFirst = false; - if (!String.IsNullOrEmpty(Path.GetExtension(name))) + if (!string.IsNullOrEmpty(Path.GetExtension(name))) { result.Add(name); commandNameAddedFirst = true; @@ -1240,7 +1240,7 @@ namespace System.Management.Automation private static bool IsQualifiedPSPath(string commandName) { Dbg.Assert( - !String.IsNullOrEmpty(commandName), + !string.IsNullOrEmpty(commandName), "The caller should have verified the commandName"); bool result = @@ -1410,7 +1410,7 @@ namespace System.Management.Automation string fileName = Path.GetFileName(_commandName); - if (!String.IsNullOrEmpty(fileName)) + if (!string.IsNullOrEmpty(fileName)) { fileName = fileName.TrimEnd(Utils.Separators.PathSearchTrimEnd); _pathSearcher = @@ -1449,7 +1449,7 @@ namespace System.Management.Automation string fileName = Path.GetFileName(_commandName); - if (!String.IsNullOrEmpty(fileName)) + if (!string.IsNullOrEmpty(fileName)) { fileName = fileName.TrimEnd(Utils.Separators.PathSearchTrimEnd); _pathSearcher = diff --git a/src/System.Management.Automation/engine/CoreAdapter.cs b/src/System.Management.Automation/engine/CoreAdapter.cs index 19033430f..2a074c096 100644 --- a/src/System.Management.Automation/engine/CoreAdapter.cs +++ b/src/System.Management.Automation/engine/CoreAdapter.cs @@ -4861,7 +4861,7 @@ namespace System.Management.Automation XmlNode node = (XmlNode)obj; string nodeNamespace = node.NamespaceURI; IEnumerable baseTypeNames = GetDotNetTypeNameHierarchy(obj); - if (String.IsNullOrEmpty(nodeNamespace)) + if (string.IsNullOrEmpty(nodeNamespace)) { foreach (string baseType in baseTypeNames) { diff --git a/src/System.Management.Automation/engine/Credential.cs b/src/System.Management.Automation/engine/Credential.cs index 6788b9d8b..f7658e466 100644 --- a/src/System.Management.Automation/engine/Credential.cs +++ b/src/System.Management.Automation/engine/Credential.cs @@ -323,7 +323,7 @@ namespace System.Management.Automation out string user, out string domain) { - if (String.IsNullOrEmpty(input)) + if (string.IsNullOrEmpty(input)) { user = domain = null; return false; diff --git a/src/System.Management.Automation/engine/DataStoreAdapter.cs b/src/System.Management.Automation/engine/DataStoreAdapter.cs index 909077efd..e50b05da7 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapter.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapter.cs @@ -506,7 +506,7 @@ namespace System.Management.Automation /// internal void SetName(string newName) { - if (String.IsNullOrEmpty(newName)) + if (string.IsNullOrEmpty(newName)) { throw PSTraceSource.NewArgumentException("newName"); } diff --git a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs index 14cc27c0f..d50e699f4 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs @@ -48,7 +48,7 @@ namespace System.Management.Automation get { string result = this.Name; - if (!String.IsNullOrEmpty(this.PSSnapInName)) + if (!string.IsNullOrEmpty(this.PSSnapInName)) { result = String.Format( @@ -374,7 +374,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("implementingType"); } - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -429,7 +429,7 @@ namespace System.Management.Automation // If the pssnapin name and provider name are specified, then both must match do // false loop { - if (!String.IsNullOrEmpty(qualifiedProviderName.PSSnapInName)) + 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) && @@ -496,7 +496,7 @@ namespace System.Management.Automation { bool result = false; - if (String.IsNullOrEmpty(psSnapinQualifiedName.PSSnapInName) || + if (string.IsNullOrEmpty(psSnapinQualifiedName.PSSnapInName) || String.Equals(psSnapinQualifiedName.PSSnapInName, PSSnapInName, StringComparison.OrdinalIgnoreCase)) { result = true; diff --git a/src/System.Management.Automation/engine/ErrorPackage.cs b/src/System.Management.Automation/engine/ErrorPackage.cs index 5eee053df..097c4ae8b 100644 --- a/src/System.Management.Automation/engine/ErrorPackage.cs +++ b/src/System.Management.Automation/engine/ErrorPackage.cs @@ -223,12 +223,12 @@ namespace System.Management.Automation { get { - if (!String.IsNullOrEmpty(_errorRecord._activityOverride)) + if (!string.IsNullOrEmpty(_errorRecord._activityOverride)) return _errorRecord._activityOverride; if (_errorRecord.InvocationInfo != null && (_errorRecord.InvocationInfo.MyCommand is CmdletInfo || _errorRecord.InvocationInfo.MyCommand is IScriptCommandInfo) - && !String.IsNullOrEmpty(_errorRecord.InvocationInfo.MyCommand.Name) + && !string.IsNullOrEmpty(_errorRecord.InvocationInfo.MyCommand.Name) ) { return _errorRecord.InvocationInfo.MyCommand.Name; @@ -257,7 +257,7 @@ namespace System.Management.Automation get { _reasonIsExceptionType = false; - if (!String.IsNullOrEmpty(_errorRecord._reasonOverride)) + if (!string.IsNullOrEmpty(_errorRecord._reasonOverride)) return _errorRecord._reasonOverride; if (_errorRecord.Exception != null) { @@ -290,7 +290,7 @@ namespace System.Management.Automation { get { - if (!String.IsNullOrEmpty(_errorRecord._targetNameOverride)) + if (!string.IsNullOrEmpty(_errorRecord._targetNameOverride)) return _errorRecord._targetNameOverride; if (_errorRecord.TargetObject != null) { @@ -330,7 +330,7 @@ namespace System.Management.Automation { get { - if (!String.IsNullOrEmpty(_errorRecord._targetTypeOverride)) + if (!string.IsNullOrEmpty(_errorRecord._targetTypeOverride)) return _errorRecord._targetTypeOverride; if (_errorRecord.TargetObject != null) { @@ -404,7 +404,7 @@ namespace System.Management.Automation { // get template text string errorCategoryString = Category.ToString(); - if (String.IsNullOrEmpty(errorCategoryString)) + if (string.IsNullOrEmpty(errorCategoryString)) { // this probably indicates an invalid ErrorCategory value errorCategoryString = ErrorCategory.NotSpecified.ToString(); @@ -412,13 +412,13 @@ namespace System.Management.Automation string templateText = ErrorCategoryStrings.ResourceManager.GetString(errorCategoryString, uiCultureInfo); - if (String.IsNullOrEmpty(templateText)) + if (string.IsNullOrEmpty(templateText)) { // this probably indicates an invalid ErrorCategory value templateText = ErrorCategoryStrings.NotSpecified; } - Diagnostics.Assert(!String.IsNullOrEmpty(templateText), + Diagnostics.Assert(!string.IsNullOrEmpty(templateText), "ErrorCategoryStrings.resx resource failure"); string activityInUse = Ellipsize(uiCultureInfo, Activity); @@ -802,10 +802,10 @@ namespace System.Management.Automation if (cmdlet == null) throw PSTraceSource.NewArgumentNullException("cmdlet"); - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) throw PSTraceSource.NewArgumentNullException("baseName"); - if (String.IsNullOrEmpty(resourceId)) + if (string.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); string template = string.Empty; @@ -837,10 +837,10 @@ namespace System.Management.Automation if (resourceSupplier == null) throw PSTraceSource.NewArgumentNullException("resourceSupplier"); - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) throw PSTraceSource.NewArgumentNullException("baseName"); - if (String.IsNullOrEmpty(resourceId)) + if (string.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); string template = string.Empty; @@ -872,10 +872,10 @@ namespace System.Management.Automation if (assembly == null) throw PSTraceSource.NewArgumentNullException("assembly"); - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) throw PSTraceSource.NewArgumentNullException("baseName"); - if (String.IsNullOrEmpty(resourceId)) + if (string.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); string template = string.Empty; @@ -1491,8 +1491,8 @@ namespace System.Management.Automation string typeName = GetInvocationTypeName(); string delimiter = - (String.IsNullOrEmpty(typeName) - || String.IsNullOrEmpty(_errorId)) + (string.IsNullOrEmpty(typeName) + || string.IsNullOrEmpty(_errorId)) ? string.Empty : ","; return NotNull(_errorId) + delimiter + NotNull(typeName); } @@ -1693,14 +1693,14 @@ namespace System.Management.Automation public override string ToString() { if (ErrorDetails != null - && !String.IsNullOrEmpty(ErrorDetails.Message)) + && !string.IsNullOrEmpty(ErrorDetails.Message)) { return ErrorDetails.Message; } if (Exception != null) { - if (!String.IsNullOrEmpty(Exception.Message)) + if (!string.IsNullOrEmpty(Exception.Message)) { return Exception.Message; } diff --git a/src/System.Management.Automation/engine/ExecutionContext.cs b/src/System.Management.Automation/engine/ExecutionContext.cs index bdb61ee4d..86b361f43 100644 --- a/src/System.Management.Automation/engine/ExecutionContext.cs +++ b/src/System.Management.Automation/engine/ExecutionContext.cs @@ -275,7 +275,7 @@ namespace System.Management.Automation { // Use the ShellID from PSAuthorizationManager before everything else because that's what's used // to check execution policy... - if (AuthorizationManager is PSAuthorizationManager && !String.IsNullOrEmpty(AuthorizationManager.ShellId)) + if (AuthorizationManager is PSAuthorizationManager && !string.IsNullOrEmpty(AuthorizationManager.ShellId)) { _shellId = AuthorizationManager.ShellId; } @@ -1347,7 +1347,7 @@ namespace System.Management.Automation // First we try to load the assembly based on the filename Assembly loadedAssembly = null; error = null; - if (!String.IsNullOrEmpty(filename)) + if (!string.IsNullOrEmpty(filename)) { try { @@ -1376,7 +1376,7 @@ namespace System.Management.Automation } // Then we try to load the assembly based on the given name - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { string fixedName = null; // Remove the '.dll' if it's there... diff --git a/src/System.Management.Automation/engine/ExternalScriptInfo.cs b/src/System.Management.Automation/engine/ExternalScriptInfo.cs index c8b79d690..48c5502b5 100644 --- a/src/System.Management.Automation/engine/ExternalScriptInfo.cs +++ b/src/System.Management.Automation/engine/ExternalScriptInfo.cs @@ -41,7 +41,7 @@ namespace System.Management.Automation internal ExternalScriptInfo(string name, string path, ExecutionContext context) : base(name, CommandTypes.ExternalScript, context) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -68,7 +68,7 @@ namespace System.Management.Automation /// internal ExternalScriptInfo(string name, string path) : base(name, CommandTypes.ExternalScript) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } diff --git a/src/System.Management.Automation/engine/GetCommandCommand.cs b/src/System.Management.Automation/engine/GetCommandCommand.cs index c7745f56c..d970149ec 100644 --- a/src/System.Management.Automation/engine/GetCommandCommand.cs +++ b/src/System.Management.Automation/engine/GetCommandCommand.cs @@ -510,7 +510,7 @@ namespace Microsoft.PowerShell.Commands // otherwise just return the object... if (Syntax) { - if (!String.IsNullOrEmpty(result.Syntax)) + if (!string.IsNullOrEmpty(result.Syntax)) { PSObject syntax = PSObject.AsPSObject(result.Syntax); @@ -732,10 +732,10 @@ namespace Microsoft.PowerShell.Commands // If the command name had no wildcards or was module-qualified, // import the module so that we can return the fully structured data. // This uses the same code path as module auto-loading. - if ((!isPattern) || (!String.IsNullOrEmpty(moduleName))) + if ((!isPattern) || (!string.IsNullOrEmpty(moduleName))) { string tempCommandName = commandName; - if ((!isModuleQualified) && (!String.IsNullOrEmpty(moduleName))) + if ((!isModuleQualified) && (!string.IsNullOrEmpty(moduleName))) { tempCommandName = moduleName + "\\" + commandName; } diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 231121c94..d3b8f2a83 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -2491,7 +2491,7 @@ namespace System.Management.Automation.Runspaces } // Start transcribing - if (!String.IsNullOrEmpty(TranscriptDirectory)) + if (!string.IsNullOrEmpty(TranscriptDirectory)) { using (PowerShell psToInvoke = PowerShell.Create()) { @@ -2681,7 +2681,7 @@ namespace System.Management.Automation.Runspaces string name = variable["Name"].ToString(); ScriptBlock sb = variable["Value"] as ScriptBlock; - if (!String.IsNullOrEmpty(name) && (sb != null)) + if (!string.IsNullOrEmpty(name) && (sb != null)) { sb.SessionStateInternal = initializedRunspace.ExecutionContext.EngineSessionState; @@ -3505,7 +3505,7 @@ namespace System.Management.Automation.Runspaces if (filesProcessed.TryAdd(sste.FileName, null)) { string moduleName = string.Empty; - if (sste.PSSnapIn != null && !String.IsNullOrEmpty(sste.PSSnapIn.Name)) + if (sste.PSSnapIn != null && !string.IsNullOrEmpty(sste.PSSnapIn.Name)) { moduleName = sste.PSSnapIn.Name; } diff --git a/src/System.Management.Automation/engine/InternalCommands.cs b/src/System.Management.Automation/engine/InternalCommands.cs index 640e4d14e..e0e86fadd 100644 --- a/src/System.Management.Automation/engine/InternalCommands.cs +++ b/src/System.Management.Automation/engine/InternalCommands.cs @@ -492,7 +492,7 @@ namespace Microsoft.PowerShell.Commands resolvedPropertyName = member.Name; } - if (!String.IsNullOrEmpty(resolvedPropertyName)) + if (!string.IsNullOrEmpty(resolvedPropertyName)) { // should process string propertyAction = String.Format(CultureInfo.InvariantCulture, @@ -683,7 +683,7 @@ namespace Microsoft.PowerShell.Commands objInString = null; } - if (String.IsNullOrEmpty(objInString)) + if (string.IsNullOrEmpty(objInString)) { var psobj = obj as PSObject; objInString = psobj != null ? psobj.BaseObject.GetType().FullName : obj.GetType().FullName; @@ -821,7 +821,7 @@ namespace Microsoft.PowerShell.Commands message = StringUtil.Format(resourceString, args); } - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) { Dbg.Assert(false, "Could not load text for error record '" + errorId + "'"); } @@ -1797,7 +1797,7 @@ namespace Microsoft.PowerShell.Commands resolvedPropertyName = members[0].Name; } - if (!String.IsNullOrEmpty(resolvedPropertyName)) + if (!string.IsNullOrEmpty(resolvedPropertyName)) { try { diff --git a/src/System.Management.Automation/engine/InvocationInfo.cs b/src/System.Management.Automation/engine/InvocationInfo.cs index b6b420691..bf36be98b 100644 --- a/src/System.Management.Automation/engine/InvocationInfo.cs +++ b/src/System.Management.Automation/engine/InvocationInfo.cs @@ -285,7 +285,7 @@ namespace System.Management.Automation { get { - if (!String.IsNullOrEmpty(ScriptPosition.File)) + if (!string.IsNullOrEmpty(ScriptPosition.File)) { return Path.GetDirectoryName(ScriptPosition.File); } diff --git a/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs b/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs index fc410f1bc..33f8cddb7 100644 --- a/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs +++ b/src/System.Management.Automation/engine/MergedCommandParameterMetadata.cs @@ -220,7 +220,7 @@ namespace System.Management.Automation private int AddParameterSetToMap(string parameterSetName) { int index = -1; - if (!String.IsNullOrEmpty(parameterSetName)) + if (!string.IsNullOrEmpty(parameterSetName)) { index = _parameterSetMap.IndexOf(parameterSetName); @@ -275,7 +275,7 @@ namespace System.Management.Automation uint defaultParameterSetFlag = 0; - if (!String.IsNullOrEmpty(defaultParameterSetName)) + if (!string.IsNullOrEmpty(defaultParameterSetName)) { _defaultParameterSetName = defaultParameterSetName; @@ -345,7 +345,7 @@ namespace System.Management.Automation { string result = _defaultParameterSetName; - if (String.IsNullOrEmpty(result)) + if (string.IsNullOrEmpty(result)) { result = ParameterAttribute.AllParameterSets; } @@ -402,7 +402,7 @@ namespace System.Management.Automation CompiledCommandParameter compiledParam = mergedParam.Parameter; if (compiledParam != null) { - if (!String.IsNullOrEmpty(compiledParam.Name)) + if (!string.IsNullOrEmpty(compiledParam.Name)) return compiledParam.Name; } } diff --git a/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs b/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs index 3397773eb..8c06def62 100644 --- a/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs @@ -516,7 +516,7 @@ namespace Microsoft.PowerShell.Commands } #endif - if (!String.IsNullOrEmpty(PSEdition)) + if (!string.IsNullOrEmpty(PSEdition)) { modules = modules.Where(module => module.CompatiblePSEditions.Contains(PSEdition, StringComparer.OrdinalIgnoreCase)); } diff --git a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs index a6bd291a8..df4bee923 100644 --- a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs @@ -600,7 +600,7 @@ namespace Microsoft.PowerShell.Commands } bool alreadyLoaded = false; - if (!String.IsNullOrEmpty(rootedPath)) + if (!string.IsNullOrEmpty(rootedPath)) { // TODO/FIXME: use IsModuleAlreadyLoaded to get consistent behavior // TODO/FIXME: (for example checking ModuleType != Manifest below seems incorrect - cdxml modules also declare their own version) diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index 8fb0ef962..ae01baf72 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -295,7 +295,7 @@ namespace Microsoft.PowerShell.Commands string extension = Path.GetExtension(name); string fileBaseName; module = null; - if (String.IsNullOrEmpty(extension) || !ModuleIntrinsics.IsPowerShellModuleExtension(extension)) + if (string.IsNullOrEmpty(extension) || !ModuleIntrinsics.IsPowerShellModuleExtension(extension)) { fileBaseName = name; extension = null; @@ -638,7 +638,7 @@ namespace Microsoft.PowerShell.Commands string extension = Path.GetExtension(moduleSpecification.Name); // First check for fully-qualified paths - either absolute or relative string rootedPath = ResolveRootedFilePath(moduleSpecification.Name, this.Context); - if (String.IsNullOrEmpty(rootedPath)) + if (string.IsNullOrEmpty(rootedPath)) { rootedPath = FixupFileName(moduleBase, moduleSpecification.Name, extension); } @@ -4284,7 +4284,7 @@ namespace Microsoft.PowerShell.Commands CultureInfo culture = System.Globalization.CultureInfo.CurrentUICulture; CultureInfo currentCulture = culture; - while (currentCulture != null && !String.IsNullOrEmpty(currentCulture.Name)) + while (currentCulture != null && !string.IsNullOrEmpty(currentCulture.Name)) { StringBuilder stringBuilder = new StringBuilder(dir); stringBuilder.Append("\\"); @@ -6525,7 +6525,7 @@ namespace Microsoft.PowerShell.Commands { PSModuleInfo module = null; - if (String.IsNullOrEmpty(moduleName) && String.IsNullOrEmpty(fileName) && assemblyToLoad == null) + if (string.IsNullOrEmpty(moduleName) && string.IsNullOrEmpty(fileName) && assemblyToLoad == null) throw PSTraceSource.NewArgumentNullException("moduleName,fileName,assemblyToLoad"); // Load the dll and process any cmdlets it might contain... @@ -7019,7 +7019,7 @@ namespace Microsoft.PowerShell.Commands internal static bool IsPrefixedCommand(CommandInfo commandInfo) { Dbg.Assert(commandInfo != null, "Caller should verify that commandInfo is not null"); - Dbg.Assert(!String.IsNullOrEmpty(commandInfo.Prefix), "Caller should verify that the commandInfo has prefix"); + Dbg.Assert(!string.IsNullOrEmpty(commandInfo.Prefix), "Caller should verify that the commandInfo has prefix"); string verb, noun; bool isPrefixed = CmdletInfo.SplitCmdletName(commandInfo.Name, out verb, out noun) diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 1a7136a5c..59bba0e2f 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -863,7 +863,7 @@ namespace System.Management.Automation foreach (Hashtable feature in features) { string featureName = feature["Name"] as string; - if (String.IsNullOrEmpty(featureName)) { continue; } + if (string.IsNullOrEmpty(featureName)) { continue; } if (ExperimentalFeature.IsModuleFeatureName(featureName, moduleName)) { @@ -1025,7 +1025,7 @@ namespace System.Management.Automation /// The path of the Windows PowerShell system module directory. internal static string GetWindowsPowerShellPSHomeModulePath() { - if (!String.IsNullOrEmpty(InternalTestHooks.TestWindowsPowerShellPSHomeLocation)) + if (!string.IsNullOrEmpty(InternalTestHooks.TestWindowsPowerShellPSHomeLocation)) { return InternalTestHooks.TestWindowsPowerShellPSHomeLocation; } diff --git a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs index 64c802ea6..96858c276 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs @@ -374,7 +374,7 @@ namespace System.Management.Automation.Internal #if UNIX return false; #else - Dbg.Assert(!String.IsNullOrEmpty(path), $"Caller to verify that {nameof(path)} is not null or empty"); + Dbg.Assert(!string.IsNullOrEmpty(path), $"Caller to verify that {nameof(path)} is not null or empty"); string windowsPowerShellPSHomePath = ModuleIntrinsics.GetWindowsPowerShellPSHomeModulePath(); return path.StartsWith(windowsPowerShellPSHomePath, StringComparison.OrdinalIgnoreCase); diff --git a/src/System.Management.Automation/engine/Modules/NewModuleCommand.cs b/src/System.Management.Automation/engine/Modules/NewModuleCommand.cs index c2f42976e..e8b4459f1 100644 --- a/src/System.Management.Automation/engine/Modules/NewModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/NewModuleCommand.cs @@ -158,7 +158,7 @@ namespace Microsoft.PowerShell.Commands if (_scriptBlock != null) { string gs = System.Guid.NewGuid().ToString(); - if (String.IsNullOrEmpty(_name)) + if (string.IsNullOrEmpty(_name)) { _name = PSModuleInfo.DynamicModulePrefixString + gs; } diff --git a/src/System.Management.Automation/engine/MshCmdlet.cs b/src/System.Management.Automation/engine/MshCmdlet.cs index f171eba0a..f52dc364d 100644 --- a/src/System.Management.Automation/engine/MshCmdlet.cs +++ b/src/System.Management.Automation/engine/MshCmdlet.cs @@ -557,7 +557,7 @@ namespace System.Management.Automation if (current.CommandType == CommandTypes.Application) { string cmdExtension = System.IO.Path.GetExtension(current.Name); - if (!String.IsNullOrEmpty(cmdExtension)) + if (!string.IsNullOrEmpty(cmdExtension)) { // Only add the application in PATHEXT... foreach (string extension in CommandDiscovery.PathExtensions) diff --git a/src/System.Management.Automation/engine/MshCommandRuntime.cs b/src/System.Management.Automation/engine/MshCommandRuntime.cs index 27bc730f3..4a77fbb31 100644 --- a/src/System.Management.Automation/engine/MshCommandRuntime.cs +++ b/src/System.Management.Automation/engine/MshCommandRuntime.cs @@ -907,7 +907,7 @@ namespace System.Management.Automation internal void SetupOutVariable() { - if (String.IsNullOrEmpty(this.OutVariable)) + if (string.IsNullOrEmpty(this.OutVariable)) { return; } @@ -917,7 +917,7 @@ namespace System.Management.Automation // Handle the creation of OutVariable in the case of Out-Default specially, // as it needs to handle much of its OutVariable support itself. if ( - (!String.IsNullOrEmpty(this.OutVariable)) && + (!string.IsNullOrEmpty(this.OutVariable)) && (!(this.OutVariable.StartsWith("+", StringComparison.Ordinal))) && String.Equals("Out-Default", _thisCommand.CommandInfo.Name, StringComparison.OrdinalIgnoreCase)) { @@ -947,7 +947,7 @@ namespace System.Management.Automation // This can't use the common SetupVariable implementation, as this needs to persist for an entire // pipeline. - if (String.IsNullOrEmpty(this.PipelineVariable)) + if (string.IsNullOrEmpty(this.PipelineVariable)) { return; } @@ -1524,7 +1524,7 @@ namespace System.Management.Automation return true; } - if (String.IsNullOrEmpty(verboseWarning)) + if (string.IsNullOrEmpty(verboseWarning)) verboseWarning = StringUtil.Format(CommandBaseStrings.ShouldProcessWarningFallback, verboseDescription); @@ -2048,7 +2048,7 @@ namespace System.Management.Automation // This code forces the stack trace and source fields to be populated if (errorRecord.Exception != null - && String.IsNullOrEmpty(errorRecord.Exception.StackTrace)) + && string.IsNullOrEmpty(errorRecord.Exception.StackTrace)) { try { @@ -2494,7 +2494,7 @@ namespace System.Management.Automation internal void SetupVariable(VariableStreamKind streamKind, string variableName, ref IList varList) { - if (String.IsNullOrEmpty(variableName)) + if (string.IsNullOrEmpty(variableName)) { return; } @@ -3550,12 +3550,12 @@ namespace System.Management.Automation pauseOption = currentOption++; } - if (String.IsNullOrEmpty(inquireMessage)) + if (string.IsNullOrEmpty(inquireMessage)) { inquireMessage = CommandBaseStrings.ShouldContinuePromptCaption; } - if (String.IsNullOrEmpty(inquireCaption)) + if (string.IsNullOrEmpty(inquireCaption)) { inquireCaption = CommandBaseStrings.InquireCaptionDefault; } diff --git a/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs b/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs index d52323e5f..b515e1b40 100644 --- a/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs +++ b/src/System.Management.Automation/engine/MshSnapinQualifiedName.cs @@ -21,7 +21,7 @@ namespace System.Management.Automation } else if (splitName.Length == 2) { - if (!String.IsNullOrEmpty(splitName[0])) + if (!string.IsNullOrEmpty(splitName[0])) { _psSnapinName = splitName[0]; } @@ -38,7 +38,7 @@ namespace System.Management.Automation // Now set the full name - if (!String.IsNullOrEmpty(_psSnapinName)) + if (!string.IsNullOrEmpty(_psSnapinName)) { _fullName = String.Format( @@ -72,7 +72,7 @@ namespace System.Management.Automation return null; result = new PSSnapinQualifiedName(splitName); // If the shortname is empty, then return null... - if (String.IsNullOrEmpty(result.ShortName)) + if (string.IsNullOrEmpty(result.ShortName)) { return null; } diff --git a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs index 72087a46f..6dece2dd5 100644 --- a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs +++ b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs @@ -190,7 +190,7 @@ namespace System.Management.Automation } } - if (!String.IsNullOrEmpty(arg)) + if (!string.IsNullOrEmpty(arg)) { _arguments.Append(separator); diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index 7d33b0ecd..e92966466 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -461,7 +461,7 @@ namespace System.Management.Automation // on Windows desktops, see if there is a file association for this command. If so then we'll use that. string executable = FindExecutable(startInfo.FileName); bool notDone = true; - if (!String.IsNullOrEmpty(executable)) + if (!string.IsNullOrEmpty(executable)) { if (IsConsoleApplication(executable)) { diff --git a/src/System.Management.Automation/engine/PSClassInfo.cs b/src/System.Management.Automation/engine/PSClassInfo.cs index 07e7befb4..c2fe50133 100644 --- a/src/System.Management.Automation/engine/PSClassInfo.cs +++ b/src/System.Management.Automation/engine/PSClassInfo.cs @@ -61,7 +61,7 @@ namespace System.Management.Automation /// internal PSClassMemberInfo(string name, string memberType, string defaultValue) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); this.Name = name; diff --git a/src/System.Management.Automation/engine/PSClassSearcher.cs b/src/System.Management.Automation/engine/PSClassSearcher.cs index a583d6501..a8a0ad317 100644 --- a/src/System.Management.Automation/engine/PSClassSearcher.cs +++ b/src/System.Management.Automation/engine/PSClassSearcher.cs @@ -317,7 +317,7 @@ namespace System.Management.Automation if (ast.GetHelpContent() != null) mamlHelpFile = ast.GetHelpContent().MamlHelpFile; - if (!String.IsNullOrEmpty(mamlHelpFile)) + if (!string.IsNullOrEmpty(mamlHelpFile)) classInfo.HelpFile = mamlHelpFile; return classInfo; diff --git a/src/System.Management.Automation/engine/PSConfiguration.cs b/src/System.Management.Automation/engine/PSConfiguration.cs index 24df53921..933b08e4f 100644 --- a/src/System.Management.Automation/engine/PSConfiguration.cs +++ b/src/System.Management.Automation/engine/PSConfiguration.cs @@ -135,7 +135,7 @@ namespace System.Management.Automation.Configuration string valueName = string.Concat(shellId, ":", "ExecutionPolicy"); string rawExecPolicy = ReadValueFromFile(scope, valueName); - if (!String.IsNullOrEmpty(rawExecPolicy)) + if (!string.IsNullOrEmpty(rawExecPolicy)) { execPolicy = rawExecPolicy; } diff --git a/src/System.Management.Automation/engine/PSVersionInfo.cs b/src/System.Management.Automation/engine/PSVersionInfo.cs index 41fc34e3d..d864f3205 100644 --- a/src/System.Management.Automation/engine/PSVersionInfo.cs +++ b/src/System.Management.Automation/engine/PSVersionInfo.cs @@ -719,9 +719,9 @@ namespace System.Management.Automation } } - if ((dashIndex != -1 && String.IsNullOrEmpty(preLabel)) || - (plusIndex != -1 && String.IsNullOrEmpty(buildLabel)) || - String.IsNullOrEmpty(versionSansLabel)) + if ((dashIndex != -1 && string.IsNullOrEmpty(preLabel)) || + (plusIndex != -1 && string.IsNullOrEmpty(buildLabel)) || + string.IsNullOrEmpty(versionSansLabel)) { // We have dash and no preReleaseLabel or // we have plus and no buildLabel or @@ -943,9 +943,9 @@ namespace System.Management.Automation // Numeric identifiers always have lower precedence than non-numeric identifiers. // A larger set of pre-release fields has a higher precedence than a smaller set, // if all of the preceding identifiers are equal. - if (String.IsNullOrEmpty(preLabel1)) { return String.IsNullOrEmpty(preLabel2) ? 0 : 1; } + if (string.IsNullOrEmpty(preLabel1)) { return string.IsNullOrEmpty(preLabel2) ? 0 : 1; } - if (String.IsNullOrEmpty(preLabel2)) { return -1; } + if (string.IsNullOrEmpty(preLabel2)) { return -1; } var units1 = preLabel1.Split('.'); var units2 = preLabel2.Split('.'); diff --git a/src/System.Management.Automation/engine/ParameterBinderController.cs b/src/System.Management.Automation/engine/ParameterBinderController.cs index 1c81d839d..5b6b7a538 100644 --- a/src/System.Management.Automation/engine/ParameterBinderController.cs +++ b/src/System.Management.Automation/engine/ParameterBinderController.cs @@ -292,7 +292,7 @@ namespace System.Management.Automation { bool result = false; - if (!String.IsNullOrEmpty(arg)) + if (!string.IsNullOrEmpty(arg)) { result = arg[0].IsDash(); } diff --git a/src/System.Management.Automation/engine/ParameterSetInfo.cs b/src/System.Management.Automation/engine/ParameterSetInfo.cs index 98852e7af..a1d09383a 100644 --- a/src/System.Management.Automation/engine/ParameterSetInfo.cs +++ b/src/System.Management.Automation/engine/ParameterSetInfo.cs @@ -48,7 +48,7 @@ namespace System.Management.Automation { IsDefault = true; Name = String.Empty; - if (String.IsNullOrEmpty(name)) + 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 d1de4d957..e88b6bcde 100644 --- a/src/System.Management.Automation/engine/ProgressRecord.cs +++ b/src/System.Management.Automation/engine/ProgressRecord.cs @@ -45,12 +45,12 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentOutOfRangeException("activityId", activityId, ProgressRecordStrings.ArgMayNotBeNegative, "activityId"); } - if (String.IsNullOrEmpty(activity)) + if (string.IsNullOrEmpty(activity)) { throw PSTraceSource.NewArgumentException("activity", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "activity"); } - if (String.IsNullOrEmpty(statusDescription)) + if (string.IsNullOrEmpty(statusDescription)) { throw PSTraceSource.NewArgumentException("activity", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "statusDescription"); } @@ -146,7 +146,7 @@ namespace System.Management.Automation set { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { throw PSTraceSource.NewArgumentException("value", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "value"); } @@ -170,7 +170,7 @@ namespace System.Management.Automation set { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { throw PSTraceSource.NewArgumentException("value", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "value"); } diff --git a/src/System.Management.Automation/engine/PseudoParameterBinder.cs b/src/System.Management.Automation/engine/PseudoParameterBinder.cs index 6b1cf19d7..e40abdac6 100644 --- a/src/System.Management.Automation/engine/PseudoParameterBinder.cs +++ b/src/System.Management.Automation/engine/PseudoParameterBinder.cs @@ -122,7 +122,7 @@ namespace System.Management.Automation /// internal override void BindParameter(string name, object value, CompiledCommandParameter parameterMetadata) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } diff --git a/src/System.Management.Automation/engine/PseudoParameters.cs b/src/System.Management.Automation/engine/PseudoParameters.cs index 2c363998c..61867f872 100644 --- a/src/System.Management.Automation/engine/PseudoParameters.cs +++ b/src/System.Management.Automation/engine/PseudoParameters.cs @@ -51,7 +51,7 @@ namespace System.Management.Automation /// public RuntimeDefinedParameter(string name, Type parameterType, Collection attributes) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -85,7 +85,7 @@ namespace System.Management.Automation set { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { throw PSTraceSource.NewArgumentException("name"); } @@ -226,7 +226,7 @@ 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; diff --git a/src/System.Management.Automation/engine/SessionState.cs b/src/System.Management.Automation/engine/SessionState.cs index a7c4688e4..417b35ff1 100644 --- a/src/System.Management.Automation/engine/SessionState.cs +++ b/src/System.Management.Automation/engine/SessionState.cs @@ -392,7 +392,7 @@ namespace System.Management.Automation private SessionStateEntryVisibility checkPathVisibility(List list, string path) { if (list == null || list.Count == 0) return SessionStateEntryVisibility.Private; - if (String.IsNullOrEmpty(path)) return SessionStateEntryVisibility.Private; + if (string.IsNullOrEmpty(path)) return SessionStateEntryVisibility.Private; if (list.Contains("*")) return SessionStateEntryVisibility.Public; foreach (string p in list) diff --git a/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs b/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs index c5d6e04d1..9c20b957f 100644 --- a/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateAliasAPIs.cs @@ -126,7 +126,7 @@ namespace System.Management.Automation internal AliasInfo GetAlias(string aliasName, CommandOrigin origin) { AliasInfo result = null; - if (String.IsNullOrEmpty(aliasName)) + if (string.IsNullOrEmpty(aliasName)) { return null; } @@ -203,7 +203,7 @@ namespace System.Management.Automation internal AliasInfo GetAliasAtScope(string aliasName, string scopeID) { AliasInfo result = null; - if (String.IsNullOrEmpty(aliasName)) + if (string.IsNullOrEmpty(aliasName)) { return null; } @@ -250,12 +250,12 @@ namespace System.Management.Automation /// internal AliasInfo SetAliasValue(string aliasName, string value, bool force, CommandOrigin origin) { - if (String.IsNullOrEmpty(aliasName)) + if (string.IsNullOrEmpty(aliasName)) { throw PSTraceSource.NewArgumentException("aliasName"); } - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { throw PSTraceSource.NewArgumentException("value"); } @@ -327,12 +327,12 @@ namespace System.Management.Automation bool force, CommandOrigin origin) { - if (String.IsNullOrEmpty(aliasName)) + if (string.IsNullOrEmpty(aliasName)) { throw PSTraceSource.NewArgumentException("aliasName"); } - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { throw PSTraceSource.NewArgumentException("value"); } @@ -521,7 +521,7 @@ namespace System.Management.Automation /// internal void RemoveAlias(string aliasName, bool force) { - if (String.IsNullOrEmpty(aliasName)) + if (string.IsNullOrEmpty(aliasName)) { throw PSTraceSource.NewArgumentException("aliasName"); } diff --git a/src/System.Management.Automation/engine/SessionStateCmdletAPIs.cs b/src/System.Management.Automation/engine/SessionStateCmdletAPIs.cs index 776c5fef2..b9287b9d7 100644 --- a/src/System.Management.Automation/engine/SessionStateCmdletAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateCmdletAPIs.cs @@ -42,7 +42,7 @@ namespace System.Management.Automation internal CmdletInfo GetCmdlet(string cmdletName, CommandOrigin origin) { CmdletInfo result = null; - if (String.IsNullOrEmpty(cmdletName)) + if (string.IsNullOrEmpty(cmdletName)) { return null; } @@ -105,7 +105,7 @@ namespace System.Management.Automation internal CmdletInfo GetCmdletAtScope(string cmdletName, string scopeID) { CmdletInfo result = null; - if (String.IsNullOrEmpty(cmdletName)) + if (string.IsNullOrEmpty(cmdletName)) { return null; } @@ -235,7 +235,7 @@ namespace System.Management.Automation /// internal void RemoveCmdlet(string name, int index, bool force, CommandOrigin origin) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -286,7 +286,7 @@ namespace System.Management.Automation /// internal void RemoveCmdletEntry(string name, bool force) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } diff --git a/src/System.Management.Automation/engine/SessionStateContainer.cs b/src/System.Management.Automation/engine/SessionStateContainer.cs index f40dab0fe..8eeba942b 100644 --- a/src/System.Management.Automation/engine/SessionStateContainer.cs +++ b/src/System.Management.Automation/engine/SessionStateContainer.cs @@ -1352,7 +1352,7 @@ namespace System.Management.Automation // Should glob paths and files that match tem*, but then // recurse into all subdirectories and do the same for // those directories. - if (!String.IsNullOrEmpty(path) && !IsItemContainer(path)) + if (!string.IsNullOrEmpty(path) && !IsItemContainer(path)) { if (!String.Equals(childName, "*", StringComparison.OrdinalIgnoreCase)) { @@ -3440,7 +3440,7 @@ namespace System.Management.Automation // Only glob the path if the name is specified - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { string providerPath = Globber.GetProviderPath(resolvePath, context, out provider, out driveInfo); @@ -3465,7 +3465,7 @@ namespace System.Management.Automation // to pass on to the provider. string composedPath = providerPath; - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { composedPath = MakePath(providerInstance, providerPath, name, context); } @@ -3505,7 +3505,7 @@ namespace System.Management.Automation string targetPath = content.ToString(); - if (String.IsNullOrEmpty(targetPath)) + if (string.IsNullOrEmpty(targetPath)) { throw PSTraceSource.NewArgumentNullException(SessionStateStrings.PathNotFound, targetPath); } @@ -3917,7 +3917,7 @@ namespace System.Management.Automation { bool result = false; - if (String.IsNullOrEmpty(providerId)) + if (string.IsNullOrEmpty(providerId)) { throw PSTraceSource.NewArgumentException("providerId"); } @@ -4225,7 +4225,7 @@ namespace System.Management.Automation { // Validate remote destination path providerDestinationPath = copyPath; - if (String.IsNullOrEmpty(providerDestinationPath)) + if (string.IsNullOrEmpty(providerDestinationPath)) { context.WriteError(new ErrorRecord( new ArgumentNullException( @@ -4546,11 +4546,11 @@ namespace System.Management.Automation "The providerInstance should have been verified by the caller"); Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(sourcePath), + !string.IsNullOrEmpty(sourcePath), "The sourcePath should have been verified by the caller"); Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(destinationPath), + !string.IsNullOrEmpty(destinationPath), "The destinationPath should have been verified by the caller"); Dbg.Diagnostics.Assert( diff --git a/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs b/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs index 335732ff4..e744bc031 100644 --- a/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateDriveAPIs.cs @@ -177,7 +177,7 @@ namespace System.Management.Automation { SessionStateScope scope = _currentScope; - if (!String.IsNullOrEmpty(scopeID)) + if (!string.IsNullOrEmpty(scopeID)) { scope = GetScopeByID(scopeID); } @@ -234,7 +234,7 @@ namespace System.Management.Automation do { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { result = false; break; @@ -536,7 +536,7 @@ namespace System.Management.Automation // so do a search through the scopes looking for the // drive. - if (String.IsNullOrEmpty(scopeID)) + if (string.IsNullOrEmpty(scopeID)) { SessionStateScopeEnumerator scopeEnumerator = new SessionStateScopeEnumerator(CurrentScope); @@ -787,7 +787,7 @@ namespace System.Management.Automation moduleName = "Microsoft.WSMan.Management"; } - if (!String.IsNullOrEmpty(moduleName)) + if (!string.IsNullOrEmpty(moduleName)) { s_tracer.WriteLine("Auto-mounting built-in drive: {0}", name); CommandInfo commandInfo = new CmdletInfo("Import-Module", typeof(Microsoft.PowerShell.Commands.ImportModuleCommand), null, null, context); @@ -949,7 +949,7 @@ namespace System.Management.Automation /// internal Collection GetDrivesForProvider(string providerId) { - if (String.IsNullOrEmpty(providerId)) + if (string.IsNullOrEmpty(providerId)) { return Drives(null); } @@ -1157,7 +1157,7 @@ namespace System.Management.Automation // so do a search through the scopes looking for the // drive. - if (String.IsNullOrEmpty(scopeID)) + if (string.IsNullOrEmpty(scopeID)) { SessionStateScopeEnumerator scopeEnumerator = new SessionStateScopeEnumerator(CurrentScope); @@ -1329,7 +1329,7 @@ namespace System.Management.Automation SessionStateScope startingScope = _currentScope; - if (!String.IsNullOrEmpty(scope)) + if (!string.IsNullOrEmpty(scope)) { startingScope = GetScopeByID(scope); } diff --git a/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs b/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs index f5b75466d..099240a90 100644 --- a/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs @@ -151,7 +151,7 @@ namespace System.Management.Automation /// internal FunctionInfo GetFunction(string name, CommandOrigin origin) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -266,7 +266,7 @@ namespace System.Management.Automation ScriptBlock function, CommandOrigin origin) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -281,7 +281,7 @@ namespace System.Management.Automation FunctionLookupPath path = new FunctionLookupPath(name); name = path.UnqualifiedPath; - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { SessionStateException exception = new SessionStateException( @@ -501,7 +501,7 @@ namespace System.Management.Automation string helpFile, bool isPreValidated) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -516,7 +516,7 @@ namespace System.Management.Automation FunctionLookupPath path = new FunctionLookupPath(name); name = path.UnqualifiedPath; - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { SessionStateException exception = new SessionStateException( @@ -580,7 +580,7 @@ namespace System.Management.Automation bool force, CommandOrigin origin) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -595,7 +595,7 @@ namespace System.Management.Automation FunctionLookupPath path = new FunctionLookupPath(name); name = path.UnqualifiedPath; - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { SessionStateException exception = new SessionStateException( @@ -708,7 +708,7 @@ namespace System.Management.Automation /// internal void RemoveFunction(string name, bool force, CommandOrigin origin) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } diff --git a/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs b/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs index b58484f7d..cfc2fcd50 100644 --- a/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateLocationAPIs.cs @@ -817,7 +817,7 @@ namespace System.Management.Automation /// internal void PushCurrentLocation(string stackName) { - if (String.IsNullOrEmpty(stackName)) + if (string.IsNullOrEmpty(stackName)) { stackName = _defaultStackName; } @@ -892,7 +892,7 @@ namespace System.Management.Automation /// internal PathInfo PopLocation(string stackName) { - if (String.IsNullOrEmpty(stackName)) + if (string.IsNullOrEmpty(stackName)) { stackName = _defaultStackName; } @@ -992,7 +992,7 @@ namespace System.Management.Automation /// internal PathInfoStack LocationStack(string stackName) { - if (String.IsNullOrEmpty(stackName)) + if (string.IsNullOrEmpty(stackName)) { stackName = _defaultStackName; } @@ -1036,7 +1036,7 @@ namespace System.Management.Automation /// internal PathInfoStack SetDefaultLocationStack(string stackName) { - if (String.IsNullOrEmpty(stackName)) + if (string.IsNullOrEmpty(stackName)) { stackName = startingDefaultStackName; } diff --git a/src/System.Management.Automation/engine/SessionStateNavigation.cs b/src/System.Management.Automation/engine/SessionStateNavigation.cs index 367d35498..1c7f27f90 100644 --- a/src/System.Management.Automation/engine/SessionStateNavigation.cs +++ b/src/System.Management.Automation/engine/SessionStateNavigation.cs @@ -176,7 +176,7 @@ namespace System.Management.Automation string result = GetParentPath(provider, pathNoQualifier, root, context); - if (!String.IsNullOrEmpty(qualifier) && !String.IsNullOrEmpty(result)) + if (!string.IsNullOrEmpty(qualifier) && !string.IsNullOrEmpty(result)) { result = AddQualifier(result, provider, qualifier, isProviderQualified, isDriveQualified); } @@ -589,7 +589,7 @@ namespace System.Management.Automation // \\HKEY_LOCAL_MACHINE if ( (GetProviderInstance(provider) is NavigationCmdletProvider) && - (!String.IsNullOrEmpty(drive.Root)) && + (!string.IsNullOrEmpty(drive.Root)) && (path.StartsWith(drive.Root, StringComparison.OrdinalIgnoreCase))) { // diff --git a/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs b/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs index dfc2ab9b6..bc43aabef 100644 --- a/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs @@ -739,7 +739,7 @@ namespace System.Management.Automation { bool result = false; - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -777,7 +777,7 @@ namespace System.Management.Automation /// internal Collection GetProvider(string name) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } @@ -881,7 +881,7 @@ namespace System.Management.Automation } } - if (!String.IsNullOrEmpty(providerName.PSSnapInName)) + if (!string.IsNullOrEmpty(providerName.PSSnapInName)) { // Be sure the PSSnapin/Module name matches @@ -1396,7 +1396,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("context"); } - if (String.IsNullOrEmpty(providerName)) + if (string.IsNullOrEmpty(providerName)) { throw PSTraceSource.NewArgumentException("providerName"); } diff --git a/src/System.Management.Automation/engine/SessionStateUtils.cs b/src/System.Management.Automation/engine/SessionStateUtils.cs index 801670e5b..6db82b2d6 100644 --- a/src/System.Management.Automation/engine/SessionStateUtils.cs +++ b/src/System.Management.Automation/engine/SessionStateUtils.cs @@ -206,7 +206,7 @@ namespace System.Management.Automation foreach (string pattern in globPatterns) { - if (!String.IsNullOrEmpty(pattern)) + if (!string.IsNullOrEmpty(pattern)) { result.Add( WildcardPattern.Get( diff --git a/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs b/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs index ccd154621..9939a4580 100644 --- a/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs @@ -1027,7 +1027,7 @@ namespace System.Management.Automation /// internal object SetVariable(PSVariable variable, bool force, CommandOrigin origin) { - if (variable == null || String.IsNullOrEmpty(variable.Name)) + if (variable == null || string.IsNullOrEmpty(variable.Name)) { throw PSTraceSource.NewArgumentException("variable"); } @@ -1402,7 +1402,7 @@ namespace System.Management.Automation /// internal object SetVariableAtScope(PSVariable variable, string scopeID, bool force, CommandOrigin origin) { - if (variable == null || String.IsNullOrEmpty(variable.Name)) + if (variable == null || string.IsNullOrEmpty(variable.Name)) { throw PSTraceSource.NewArgumentException("variable"); } @@ -1438,7 +1438,7 @@ namespace System.Management.Automation /// internal object NewVariable(PSVariable variable, bool force) { - if (variable == null || String.IsNullOrEmpty(variable.Name)) + if (variable == null || string.IsNullOrEmpty(variable.Name)) { throw PSTraceSource.NewArgumentException("variable"); } @@ -1482,7 +1482,7 @@ namespace System.Management.Automation /// internal object NewVariableAtScope(PSVariable variable, string scopeID, bool force) { - if (variable == null || String.IsNullOrEmpty(variable.Name)) + if (variable == null || string.IsNullOrEmpty(variable.Name)) { throw PSTraceSource.NewArgumentException("variable"); } @@ -1695,7 +1695,7 @@ namespace System.Management.Automation /// internal void RemoveVariableAtScope(string name, string scopeID, bool force) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } diff --git a/src/System.Management.Automation/engine/ShellVariable.cs b/src/System.Management.Automation/engine/ShellVariable.cs index 21952a53e..739258be3 100644 --- a/src/System.Management.Automation/engine/ShellVariable.cs +++ b/src/System.Management.Automation/engine/ShellVariable.cs @@ -157,7 +157,7 @@ namespace System.Management.Automation ScopedItemOptions options, Collection attributes) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } diff --git a/src/System.Management.Automation/engine/TypeTable.cs b/src/System.Management.Automation/engine/TypeTable.cs index a6d2c31cb..80305e753 100644 --- a/src/System.Management.Automation/engine/TypeTable.cs +++ b/src/System.Management.Automation/engine/TypeTable.cs @@ -1413,7 +1413,7 @@ namespace System.Management.Automation.Runspaces { protected override void SetItem(int index, string item) { - if (String.IsNullOrEmpty(item)) + if (string.IsNullOrEmpty(item)) { throw PSTraceSource.NewArgumentException("item"); } @@ -1430,7 +1430,7 @@ namespace System.Management.Automation.Runspaces protected override void InsertItem(int index, string item) { - if (String.IsNullOrEmpty(item)) + if (string.IsNullOrEmpty(item)) { throw PSTraceSource.NewArgumentException("item"); } @@ -1479,7 +1479,7 @@ namespace System.Management.Automation.Runspaces for (int i = 0; i < this.Count; i++) { string str = this[i]; - if (String.IsNullOrEmpty(str)) + if (string.IsNullOrEmpty(str)) { throw PSTraceSource.NewArgumentException("strings"); } @@ -3037,7 +3037,7 @@ namespace System.Management.Automation.Runspaces internal static void ProcessAliasData(ConcurrentBag errors, string typeName, AliasPropertyData aliasData, PSMemberInfoInternalCollection membersCollection, bool isOverride) { // ReferencedMemberName should not be an empty string - if (String.IsNullOrEmpty(aliasData.ReferencedMemberName)) + if (string.IsNullOrEmpty(aliasData.ReferencedMemberName)) { AddError(errors, typeName, TypesXmlStrings.TypeDataShouldHaveValue, "AliasPropertyData", "ReferencedMemberName"); return; @@ -3137,7 +3137,7 @@ namespace System.Management.Automation.Runspaces Collection referencedProperties = new Collection(); foreach (string name in propertySetData.ReferencedProperties) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { AddError(errors, typeName, TypesXmlStrings.TypeDataShouldNotBeNullOrEmpty, "PropertySetData", "ReferencedProperties"); continue; @@ -3253,7 +3253,7 @@ namespace System.Management.Automation.Runspaces private void ProcessTypeDataToAdd(ConcurrentBag errors, TypeData typeData) { string typeName = typeData.TypeName; - Dbg.Assert(!String.IsNullOrEmpty(typeName), "TypeData class guarantees the typeName is not null and not empty"); + Dbg.Assert(!string.IsNullOrEmpty(typeName), "TypeData class guarantees the typeName is not null and not empty"); var propertySets = new Collection(); if (typeData.DefaultDisplayPropertySet != null) @@ -3373,7 +3373,7 @@ namespace System.Management.Automation.Runspaces private void ProcessTypeDataToRemove(ConcurrentBag errors, TypeData typeData) { string typeName = typeData.TypeName; - Dbg.Assert(!String.IsNullOrEmpty(typeName), "TypeData class guarantees the typeName is not null and not empty"); + Dbg.Assert(!string.IsNullOrEmpty(typeName), "TypeData class guarantees the typeName is not null and not empty"); // We always remove the whole type bool typeExist = false; @@ -4314,7 +4314,7 @@ namespace System.Management.Automation.Runspaces /// The name of the type to remove from TypeTable. public void RemoveType(string typeName) { - if (String.IsNullOrEmpty(typeName)) + if (string.IsNullOrEmpty(typeName)) throw PSTraceSource.NewArgumentNullException("typeName"); Dbg.Assert(isShared, "This method should only be called by the developer user. It should not be used internally."); diff --git a/src/System.Management.Automation/engine/cmdlet.cs b/src/System.Management.Automation/engine/cmdlet.cs index ce08df2b0..21ef53280 100644 --- a/src/System.Management.Automation/engine/cmdlet.cs +++ b/src/System.Management.Automation/engine/cmdlet.cs @@ -251,10 +251,10 @@ namespace System.Management.Automation { using (PSTransactionManager.GetEngineProtectionScope()) { - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) throw PSTraceSource.NewArgumentNullException("baseName"); - if (String.IsNullOrEmpty(resourceId)) + if (string.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); ResourceManager manager = ResourceManagerCache.GetResourceManager(this.GetType().Assembly, baseName); @@ -682,7 +682,7 @@ namespace System.Management.Automation if (commandRuntime2 != null) { string source = this.MyInvocation.PSCommandPath; - if (String.IsNullOrEmpty(source)) + if (string.IsNullOrEmpty(source)) { source = this.MyInvocation.MyCommand.Name; } diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 7df3c202e..8fae3806b 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -3813,7 +3813,7 @@ namespace System.Management.Automation message = StringUtil.Format(resourceString, args); } - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) { message = "Could not load text for msh script tracing message id '" + messageId + "'"; Diagnostics.Assert(false, message); @@ -3839,7 +3839,7 @@ namespace System.Management.Automation internal void TraceScriptFunctionEntry(FunctionContext functionContext) { var methodName = functionContext._functionName; - if (String.IsNullOrEmpty(functionContext._file)) + if (string.IsNullOrEmpty(functionContext._file)) { Trace("TraceEnteringFunction", ParserStrings.TraceEnteringFunction, methodName); } diff --git a/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs b/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs index 09152c832..d7979a3dd 100644 --- a/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs +++ b/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs @@ -36,7 +36,7 @@ namespace System.Management.Automation.Host { // the only required parameter is label. - if (String.IsNullOrEmpty(label)) + if (string.IsNullOrEmpty(label)) { // "label" is not localizable throw PSTraceSource.NewArgumentException("label", DescriptionsStrings.NullOrEmptyErrorTemplate, "label"); @@ -66,7 +66,7 @@ namespace System.Management.Automation.Host { // the only required parameter is label. - if (String.IsNullOrEmpty(label)) + if (string.IsNullOrEmpty(label)) { // "label" is not localizable throw PSTraceSource.NewArgumentException("label", DescriptionsStrings.NullOrEmptyErrorTemplate, "label"); diff --git a/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs b/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs index 5e51c44e5..6e7578637 100644 --- a/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs +++ b/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs @@ -40,7 +40,7 @@ namespace System.Management.Automation.Host { // the only required parameter is the name. - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name", DescriptionsStrings.NullOrEmptyErrorTemplate, "name"); } @@ -102,7 +102,7 @@ namespace System.Management.Automation.Host { get { - if (String.IsNullOrEmpty(parameterTypeName)) + if (string.IsNullOrEmpty(parameterTypeName)) { // the default if the type name is not specified is 'string' @@ -129,7 +129,7 @@ namespace System.Management.Automation.Host { get { - if (String.IsNullOrEmpty(parameterTypeFullName)) + if (string.IsNullOrEmpty(parameterTypeFullName)) { // the default if the type name is not specified is 'string' @@ -157,7 +157,7 @@ namespace System.Management.Automation.Host { get { - if (String.IsNullOrEmpty(parameterAssemblyFullName)) + if (string.IsNullOrEmpty(parameterAssemblyFullName)) { // the default if the type name is not specified is 'string' @@ -316,7 +316,7 @@ namespace System.Management.Automation.Host void SetParameterTypeName(string nameOfType) { - if (String.IsNullOrEmpty(nameOfType)) + if (string.IsNullOrEmpty(nameOfType)) { throw PSTraceSource.NewArgumentException("nameOfType", DescriptionsStrings.NullOrEmptyErrorTemplate, "nameOfType"); } @@ -336,7 +336,7 @@ namespace System.Management.Automation.Host void SetParameterTypeFullName(string fullNameOfType) { - if (String.IsNullOrEmpty(fullNameOfType)) + if (string.IsNullOrEmpty(fullNameOfType)) { throw PSTraceSource.NewArgumentException("fullNameOfType", DescriptionsStrings.NullOrEmptyErrorTemplate, "fullNameOfType"); } @@ -356,7 +356,7 @@ namespace System.Management.Automation.Host void SetParameterAssemblyFullName(string fullNameOfAssembly) { - if (String.IsNullOrEmpty(fullNameOfAssembly)) + if (string.IsNullOrEmpty(fullNameOfAssembly)) { throw PSTraceSource.NewArgumentException("fullNameOfAssembly", DescriptionsStrings.NullOrEmptyErrorTemplate, "fullNameOfAssembly"); } diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs index 7c837ebef..e7ed42a62 100644 --- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs @@ -232,7 +232,7 @@ namespace System.Management.Automation /// The first lines of . internal static string GetMaxLines(string source, int maxLines) { - if (String.IsNullOrEmpty(source)) + if (string.IsNullOrEmpty(source)) { return String.Empty; } @@ -390,7 +390,7 @@ namespace System.Management.Automation { string suggestionText = GetSuggestionText(suggestion["Suggestion"], (object[])suggestion["SuggestionArgs"], invocationModule); - if (!String.IsNullOrEmpty(suggestionText)) + if (!string.IsNullOrEmpty(suggestionText)) { string returnString = String.Format( CultureInfo.CurrentCulture, @@ -442,7 +442,7 @@ namespace System.Management.Automation { string suggestionText = GetSuggestionText(suggestion["Suggestion"], (object[])suggestion["SuggestionArgs"], invocationModule); - if (!String.IsNullOrEmpty(suggestionText)) + if (!string.IsNullOrEmpty(suggestionText)) { string returnString = String.Format( CultureInfo.CurrentCulture, @@ -475,7 +475,7 @@ namespace System.Management.Automation internal static string RemoveGuidFromMessage(string message, out bool matchPattern) { matchPattern = false; - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) return message; const string pattern = @"^([\d\w]{8}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{12}:).*"; @@ -493,7 +493,7 @@ namespace System.Management.Automation internal static string RemoveIdentifierInfoFromMessage(string message, out bool matchPattern) { matchPattern = false; - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) return message; const string pattern = @"^([\d\w]{8}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{12}:\[.*\]:).*"; @@ -701,7 +701,7 @@ namespace System.Management.Automation passwordBuilder[counter] = (char)0; } - if (!String.IsNullOrEmpty(credentialUsername)) + if (!string.IsNullOrEmpty(credentialUsername)) cred = new PSCredential(credentialUsername, password); else cred = null; diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHost.cs b/src/System.Management.Automation/engine/hostifaces/InternalHost.cs index 4807857bf..56ace644d 100644 --- a/src/System.Management.Automation/engine/hostifaces/InternalHost.cs +++ b/src/System.Management.Automation/engine/hostifaces/InternalHost.cs @@ -64,12 +64,12 @@ namespace System.Management.Automation.Internal.Host { get { - if (String.IsNullOrEmpty(_nameResult)) + if (string.IsNullOrEmpty(_nameResult)) { _nameResult = _externalHostRef.Value.Name; #pragma warning disable 56503 - if (String.IsNullOrEmpty(_nameResult)) + if (string.IsNullOrEmpty(_nameResult)) { throw PSTraceSource.NewNotImplementedException(); } diff --git a/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs index 5b20c34cb..0f48ca157 100644 --- a/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs @@ -986,7 +986,7 @@ namespace System.Management.Automation.Host internal static string GetTranscriptPath(string baseDirectory, bool includeDate) { - if (String.IsNullOrEmpty(baseDirectory)) + if (string.IsNullOrEmpty(baseDirectory)) { baseDirectory = Platform.GetFolderPath(Environment.SpecialFolder.MyDocuments); } diff --git a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs index 58314ce44..28f3db0fe 100644 --- a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs +++ b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs @@ -5288,7 +5288,7 @@ namespace System.Management.Automation localPipeline.IsChild = _shell.IsChild; - if (!String.IsNullOrEmpty(_shell.HistoryString)) + if (!string.IsNullOrEmpty(_shell.HistoryString)) { localPipeline.SetHistoryString(_shell.HistoryString); } diff --git a/src/System.Management.Automation/engine/interpreter/Utilities.cs b/src/System.Management.Automation/engine/interpreter/Utilities.cs index a330da72d..fdc8c5342 100644 --- a/src/System.Management.Automation/engine/interpreter/Utilities.cs +++ b/src/System.Management.Automation/engine/interpreter/Utilities.cs @@ -939,7 +939,7 @@ namespace System.Management.Automation.Interpreter [Conditional("DEBUG")] public static void NotEmpty(string str) { - Debug.Assert(!String.IsNullOrEmpty(str)); + Debug.Assert(!string.IsNullOrEmpty(str)); } } diff --git a/src/System.Management.Automation/engine/lang/parserutils.cs b/src/System.Management.Automation/engine/lang/parserutils.cs index b4d6d3e19..887d4f075 100644 --- a/src/System.Management.Automation/engine/lang/parserutils.cs +++ b/src/System.Management.Automation/engine/lang/parserutils.cs @@ -139,7 +139,7 @@ namespace System.Management.Automation // If the flow statement has no label, it always matches (because it just means, break or continue from // the most nested loop.) Otherwise, compare the labels. - return String.IsNullOrEmpty(flowLabel) || flowLabel.Equals(loopLabel, StringComparison.OrdinalIgnoreCase); + return string.IsNullOrEmpty(flowLabel) || flowLabel.Equals(loopLabel, StringComparison.OrdinalIgnoreCase); } } @@ -1786,7 +1786,7 @@ namespace System.Management.Automation Type exceptionType, IScriptExtent errorPosition, string resourceIdAndErrorId, string resourceString, Exception innerException, params object[] args) { // errToken may be null - if (String.IsNullOrEmpty(resourceIdAndErrorId)) + if (string.IsNullOrEmpty(resourceIdAndErrorId)) throw PSTraceSource.NewArgumentException("resourceIdAndErrorId"); // innerException may be null // args may be null or empty @@ -1806,7 +1806,7 @@ namespace System.Management.Automation message = StringUtil.Format(resourceString, args); } - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) { Dbg.Assert(false, "Could not load text for parser exception '" @@ -1862,8 +1862,8 @@ namespace System.Management.Automation { // errToken may be null // only assert -- be permissive at runtime - Dbg.Assert(!String.IsNullOrEmpty(message), "message was null or empty"); - Dbg.Assert(!String.IsNullOrEmpty(errorId), "errorId was null or empty"); + Dbg.Assert(!string.IsNullOrEmpty(message), "message was null or empty"); + Dbg.Assert(!string.IsNullOrEmpty(errorId), "errorId was null or empty"); // innerException may be null RuntimeException e; @@ -1967,7 +1967,7 @@ namespace System.Management.Automation message = StringUtil.Format(resourceString, args); } - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) { message = "Could not load text for msh script tracing message id '" + messageId + "'"; Dbg.Assert(false, message); diff --git a/src/System.Management.Automation/engine/parser/DebugViewWriter.cs b/src/System.Management.Automation/engine/parser/DebugViewWriter.cs index 36725b9ff..749685ad3 100644 --- a/src/System.Management.Automation/engine/parser/DebugViewWriter.cs +++ b/src/System.Management.Automation/engine/parser/DebugViewWriter.cs @@ -113,17 +113,17 @@ namespace System.Management.Automation.Language { } private int GetLambdaId(LambdaExpression le) { - Debug.Assert(String.IsNullOrEmpty(le.Name)); + Debug.Assert(string.IsNullOrEmpty(le.Name)); return GetId(le, ref _lambdaIds); } private int GetParamId(ParameterExpression p) { - Debug.Assert(String.IsNullOrEmpty(p.Name)); + Debug.Assert(string.IsNullOrEmpty(p.Name)); return GetId(p, ref _paramIds); } private int GetLabelTargetId(LabelTarget target) { - Debug.Assert(String.IsNullOrEmpty(target.Name)); + Debug.Assert(string.IsNullOrEmpty(target.Name)); return GetId(target, ref _labelIds); } @@ -432,7 +432,7 @@ namespace System.Management.Automation.Language { protected override Expression VisitParameter(ParameterExpression node) { // Have '$' for the DebugView of ParameterExpressions Out("$"); - if (String.IsNullOrEmpty(node.Name)) { + if (string.IsNullOrEmpty(node.Name)) { // If no name if provided, generate a name as $var1, $var2. // No guarantee for not having name conflicts with user provided variable names. // @@ -1183,7 +1183,7 @@ namespace System.Management.Automation.Language { } private string GetLambdaName(LambdaExpression lambda) { - if (String.IsNullOrEmpty(lambda.Name)) { + if (string.IsNullOrEmpty(lambda.Name)) { return "#Lambda" + GetLambdaId(lambda); } diff --git a/src/System.Management.Automation/engine/parser/Parser.cs b/src/System.Management.Automation/engine/parser/Parser.cs index 183b4e637..c509c894a 100644 --- a/src/System.Management.Automation/engine/parser/Parser.cs +++ b/src/System.Management.Automation/engine/parser/Parser.cs @@ -4498,7 +4498,7 @@ namespace System.Management.Automation.Language endExtent = terminatorToken.Extent; } - if (!String.IsNullOrEmpty(varToken.Name)) + if (!string.IsNullOrEmpty(varToken.Name)) { return new PropertyMemberAst(ExtentOf(startExtent, endExtent), varToken.Name, typeConstraint, attributeList, attributes, initialValueAst); diff --git a/src/System.Management.Automation/engine/parser/Position.cs b/src/System.Management.Automation/engine/parser/Position.cs index 079ba40e7..4891b9dc9 100644 --- a/src/System.Management.Automation/engine/parser/Position.cs +++ b/src/System.Management.Automation/engine/parser/Position.cs @@ -134,7 +134,7 @@ namespace System.Management.Automation.Language } string fileName = position.File; - if (String.IsNullOrEmpty(fileName)) + if (string.IsNullOrEmpty(fileName)) { fileName = ParserStrings.TextForWordLine; } @@ -142,7 +142,7 @@ namespace System.Management.Automation.Language string sourceLine = position.StartScriptPosition.Line.TrimEnd(); string message = string.Empty; - if (!String.IsNullOrEmpty(sourceLine)) + if (!string.IsNullOrEmpty(sourceLine)) { int spacesBeforeError = position.StartColumnNumber - 1; int errorLength = (position.StartLineNumber == position.EndLineNumber) @@ -565,12 +565,12 @@ namespace System.Management.Automation.Language return false; } - if ((String.IsNullOrEmpty(otherPosition.File)) && + if ((string.IsNullOrEmpty(otherPosition.File)) && (otherPosition.StartLineNumber == StartLineNumber) && (otherPosition.StartColumnNumber == StartColumnNumber) && (otherPosition.EndLineNumber == EndLineNumber) && (otherPosition.EndColumnNumber == EndColumnNumber) && - (String.IsNullOrEmpty(otherPosition.Text))) + (string.IsNullOrEmpty(otherPosition.Text))) { return true; } diff --git a/src/System.Management.Automation/engine/parser/SemanticChecks.cs b/src/System.Management.Automation/engine/parser/SemanticChecks.cs index 97627af9c..f1e4f9b72 100644 --- a/src/System.Management.Automation/engine/parser/SemanticChecks.cs +++ b/src/System.Management.Automation/engine/parser/SemanticChecks.cs @@ -572,7 +572,7 @@ namespace System.Management.Automation.Language /// Label name. Can be null. private void CheckLabelExists(StatementAst ast, string label) { - if (String.IsNullOrEmpty(label)) + if (string.IsNullOrEmpty(label)) { return; } diff --git a/src/System.Management.Automation/engine/pipeline.cs b/src/System.Management.Automation/engine/pipeline.cs index 997f207e6..29fa707b0 100644 --- a/src/System.Management.Automation/engine/pipeline.cs +++ b/src/System.Management.Automation/engine/pipeline.cs @@ -217,7 +217,7 @@ namespace System.Management.Automation.Internal } // Log the cmdlet invocation execution details if we didn't have an associated script line with it. - if ((invocation == null) || String.IsNullOrEmpty(invocation.Line)) + if ((invocation == null) || string.IsNullOrEmpty(invocation.Line)) { if (hostInterface != null) { @@ -225,7 +225,7 @@ namespace System.Management.Automation.Internal } } - if (!String.IsNullOrEmpty(logElement)) + if (!string.IsNullOrEmpty(logElement)) { _eventLogBuffer.Add(logElement); } diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index 54d818b22..a209ba7f7 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -432,7 +432,7 @@ namespace System.Management.Automation protected Job(string command, string name) : this(command) { - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { _name = name; } @@ -472,7 +472,7 @@ namespace System.Management.Automation Id = token.Id; InstanceId = token.InstanceId; - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { _name = name; } @@ -3358,11 +3358,11 @@ namespace System.Management.Automation errorDetails += message; } - else if (!String.IsNullOrEmpty(transException.Message)) + else if (!string.IsNullOrEmpty(transException.Message)) { errorDetails += transException.Message; } - else if (!String.IsNullOrEmpty(transException.TransportMessage)) + else if (!string.IsNullOrEmpty(transException.TransportMessage)) { errorDetails += transException.TransportMessage; } diff --git a/src/System.Management.Automation/engine/remoting/client/Job2.cs b/src/System.Management.Automation/engine/remoting/client/Job2.cs index 8773a6784..82fe542e3 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job2.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job2.cs @@ -2045,7 +2045,7 @@ namespace System.Management.Automation for (int i = 0; i < ChildJobs.Count; i++) { - if (!String.IsNullOrEmpty(ChildJobs[i].StatusMessage)) + if (!string.IsNullOrEmpty(ChildJobs[i].StatusMessage)) { sb.Append(ChildJobs[i].StatusMessage); } diff --git a/src/System.Management.Automation/engine/remoting/client/JobManager.cs b/src/System.Management.Automation/engine/remoting/client/JobManager.cs index b1d4d41bb..4d1cbec7c 100644 --- a/src/System.Management.Automation/engine/remoting/client/JobManager.cs +++ b/src/System.Management.Automation/engine/remoting/client/JobManager.cs @@ -53,7 +53,7 @@ namespace System.Management.Automation /// Whether the type is registered already. public bool IsRegistered(string typeName) { - if (String.IsNullOrEmpty(typeName)) + if (string.IsNullOrEmpty(typeName)) { return false; } diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index c251dc72a..7a1abbb49 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -2431,7 +2431,7 @@ else // Getting the string value of the object if it is not a ModuleSpecification, this is required for the cases like PSObject is specified as ModulesToImport value. string modulepath = s.ToString(); // Add this check after checking if it a path - if (!String.IsNullOrEmpty(modulepath.Trim())) + if (!string.IsNullOrEmpty(modulepath.Trim())) { if ((modulepath.Contains("\\") || modulepath.Contains(":")) && !(Directory.Exists(modulepath) || File.Exists(modulepath))) @@ -5516,7 +5516,7 @@ Disable-PSRemoting -force:$args[0] -queryForSet $args[1] -captionForSet $args[2] // The validator that will be applied to the role lookup Func validator = (role) => true; - if (!String.IsNullOrEmpty(this.Username)) + if (!string.IsNullOrEmpty(this.Username)) { if (this.Username.IndexOf("\\", StringComparison.OrdinalIgnoreCase) >= 0) { diff --git a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs index 4594940a4..19195587b 100644 --- a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs @@ -494,7 +494,7 @@ namespace Microsoft.PowerShell.Commands set { - if (!String.IsNullOrEmpty(value)) + if (!string.IsNullOrEmpty(value)) { _name = value; _asjob = true; @@ -920,7 +920,7 @@ namespace Microsoft.PowerShell.Commands return; } - if (String.IsNullOrEmpty(ConfigurationName)) + if (string.IsNullOrEmpty(ConfigurationName)) { if ((ParameterSetName == InvokeCommandCommand.ComputerNameParameterSet) || (ParameterSetName == InvokeCommandCommand.UriParameterSet) || diff --git a/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs b/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs index b888f35d5..df2e51976 100644 --- a/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs +++ b/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs @@ -640,7 +640,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - Debug.Assert(!String.IsNullOrEmpty(_path)); + Debug.Assert(!string.IsNullOrEmpty(_path)); ProviderInfo provider = null; PSDriveInfo drive; @@ -690,7 +690,7 @@ namespace Microsoft.PowerShell.Commands result.Append(SessionConfigurationUtils.ConfigFragment(ConfigFileConstants.Guid, RemotingErrorIdStrings.DISCGUIDComment, SessionConfigurationUtils.QuoteName(_guid), streamWriter, false)); // Author - if (String.IsNullOrEmpty(_author)) + if (string.IsNullOrEmpty(_author)) { _author = Environment.UserName; } @@ -700,12 +700,12 @@ namespace Microsoft.PowerShell.Commands // Description result.Append(SessionConfigurationUtils.ConfigFragment(ConfigFileConstants.Description, RemotingErrorIdStrings.DISCDescriptionComment, - SessionConfigurationUtils.QuoteName(_description), streamWriter, String.IsNullOrEmpty(_description))); + SessionConfigurationUtils.QuoteName(_description), streamWriter, string.IsNullOrEmpty(_description))); // Company name if (ShouldGenerateConfigurationSnippet("CompanyName")) { - if (String.IsNullOrEmpty(_companyName)) + if (string.IsNullOrEmpty(_companyName)) { _companyName = Modules.DefaultCompanyName; } @@ -717,7 +717,7 @@ namespace Microsoft.PowerShell.Commands // Copyright if (ShouldGenerateConfigurationSnippet("Copyright")) { - if (String.IsNullOrEmpty(_copyright)) + if (string.IsNullOrEmpty(_copyright)) { _copyright = StringUtil.Format(Modules.DefaultCopyrightMessage, _author); } @@ -733,9 +733,9 @@ namespace Microsoft.PowerShell.Commands string resultData = null; // Transcript directory - resultData = String.IsNullOrEmpty(_transcriptDirectory) ? "'C:\\Transcripts\\'" : SessionConfigurationUtils.QuoteName(_transcriptDirectory); + resultData = string.IsNullOrEmpty(_transcriptDirectory) ? "'C:\\Transcripts\\'" : SessionConfigurationUtils.QuoteName(_transcriptDirectory); result.Append(SessionConfigurationUtils.ConfigFragment(ConfigFileConstants.TranscriptDirectory, RemotingErrorIdStrings.DISCTranscriptDirectoryComment, - resultData, streamWriter, String.IsNullOrEmpty(_transcriptDirectory))); + resultData, streamWriter, string.IsNullOrEmpty(_transcriptDirectory))); // Run as virtual account result.Append(SessionConfigurationUtils.ConfigFragment(ConfigFileConstants.RunAsVirtualAccount, RemotingErrorIdStrings.DISCRunAsVirtualAccountComment, @@ -1542,7 +1542,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - Debug.Assert(!String.IsNullOrEmpty(_path)); + Debug.Assert(!string.IsNullOrEmpty(_path)); ProviderInfo provider = null; PSDriveInfo drive; @@ -1588,7 +1588,7 @@ namespace Microsoft.PowerShell.Commands result.Append(SessionConfigurationUtils.ConfigFragment(ConfigFileConstants.Guid, RemotingErrorIdStrings.DISCGUIDComment, SessionConfigurationUtils.QuoteName(_guid), streamWriter, false)); // Author - if (String.IsNullOrEmpty(_author)) + if (string.IsNullOrEmpty(_author)) { _author = Environment.UserName; } @@ -1598,10 +1598,10 @@ namespace Microsoft.PowerShell.Commands // Description result.Append(SessionConfigurationUtils.ConfigFragment(ConfigFileConstants.Description, RemotingErrorIdStrings.DISCDescriptionComment, - SessionConfigurationUtils.QuoteName(_description), streamWriter, String.IsNullOrEmpty(_description))); + SessionConfigurationUtils.QuoteName(_description), streamWriter, string.IsNullOrEmpty(_description))); // Company name - if (String.IsNullOrEmpty(_companyName)) + if (string.IsNullOrEmpty(_companyName)) { _companyName = Modules.DefaultCompanyName; } @@ -1610,7 +1610,7 @@ namespace Microsoft.PowerShell.Commands SessionConfigurationUtils.QuoteName(_companyName), streamWriter, false)); // Copyright - if (String.IsNullOrEmpty(_copyright)) + if (string.IsNullOrEmpty(_copyright)) { _copyright = StringUtil.Format(Modules.DefaultCopyrightMessage, _author); } @@ -2087,7 +2087,7 @@ namespace Microsoft.PowerShell.Commands for (int i = 0; i < values.Length; i++) { - if (!String.IsNullOrEmpty(values[i])) + if (!string.IsNullOrEmpty(values[i])) { sb.Append(QuoteName(values[i])); @@ -2110,7 +2110,7 @@ namespace Microsoft.PowerShell.Commands for (int i = 0; i < values.Length; i++) { string strVal = values[i] as string; - if (!String.IsNullOrEmpty(strVal)) + if (!string.IsNullOrEmpty(strVal)) { sb.Append(QuoteName(strVal)); } diff --git a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs index 998416b65..ba72085b1 100644 --- a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs +++ b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs @@ -227,7 +227,7 @@ namespace Microsoft.PowerShell.Commands { string resolvedShell; - if (!String.IsNullOrEmpty(shell)) + if (!string.IsNullOrEmpty(shell)) { resolvedShell = shell; } @@ -252,7 +252,7 @@ namespace Microsoft.PowerShell.Commands { string resolvedAppName; - if (!String.IsNullOrEmpty(appName)) + if (!string.IsNullOrEmpty(appName)) { resolvedAppName = appName; } @@ -1111,7 +1111,7 @@ namespace Microsoft.PowerShell.Commands idleTimeout / 1000, BaseTransportManager.MinimumIdleTimeout / 1000)); } - if (String.IsNullOrEmpty(_appName)) + if (string.IsNullOrEmpty(_appName)) { _appName = ResolveAppName(null); } @@ -2942,7 +2942,7 @@ namespace Microsoft.PowerShell.Commands bool supportWildChar; string[] sessionNames = { "*" }; WildcardPattern configurationNamePattern = - String.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); + string.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); Dictionary matches = new Dictionary(); List remoteRunspaceInfos = this.RunspaceRepository.Runspaces; @@ -2974,7 +2974,7 @@ namespace Microsoft.PowerShell.Commands foreach (string sessionName in sessionNames) { WildcardPattern sessionNamePattern = - String.IsNullOrEmpty(sessionName) ? null : WildcardPattern.Get(sessionName, WildcardOptions.IgnoreCase); + string.IsNullOrEmpty(sessionName) ? null : WildcardPattern.Get(sessionName, WildcardOptions.IgnoreCase); var matchingRunspaceInfos = remoteRunspaceInfos .Where(session => (supportWildChar ? inputNamePattern.IsMatch(session.VMName) @@ -3009,7 +3009,7 @@ namespace Microsoft.PowerShell.Commands TargetMachineType computerType; bool supportWildChar; WildcardPattern configurationNamePattern = - String.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); + string.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); Dictionary matches = new Dictionary(); List remoteRunspaceInfos = this.RunspaceRepository.Runspaces; @@ -3063,7 +3063,7 @@ namespace Microsoft.PowerShell.Commands { string[] sessionNames = { "*" }; WildcardPattern configurationNamePattern = - String.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); + string.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); Dictionary matches = new Dictionary(); List remoteRunspaceInfos = this.RunspaceRepository.Runspaces; @@ -3078,7 +3078,7 @@ namespace Microsoft.PowerShell.Commands foreach (string sessionName in sessionNames) { WildcardPattern sessionNamePattern = - String.IsNullOrEmpty(sessionName) ? null : WildcardPattern.Get(sessionName, WildcardOptions.IgnoreCase); + string.IsNullOrEmpty(sessionName) ? null : WildcardPattern.Get(sessionName, WildcardOptions.IgnoreCase); var matchingRunspaceInfos = remoteRunspaceInfos .Where(session => vmId.Equals(session.VMId) && @@ -3107,7 +3107,7 @@ namespace Microsoft.PowerShell.Commands string configurationName) { WildcardPattern configurationNamePattern = - String.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); + string.IsNullOrEmpty(configurationName) ? null : WildcardPattern.Get(configurationName, WildcardOptions.IgnoreCase); Dictionary matches = new Dictionary(); List remoteRunspaceInfos = this.RunspaceRepository.Runspaces; diff --git a/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs b/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs index 6e7824d0f..fc8140e78 100644 --- a/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/PushRunspaceCommand.cs @@ -210,7 +210,7 @@ namespace Microsoft.PowerShell.Commands { base.BeginProcessing(); - if (String.IsNullOrEmpty(ConfigurationName)) + if (string.IsNullOrEmpty(ConfigurationName)) { if ((ParameterSetName == EnterPSSessionCommand.ComputerNameParameterSet) || (ParameterSetName == EnterPSSessionCommand.UriParameterSet)) @@ -1214,7 +1214,7 @@ namespace Microsoft.PowerShell.Commands try { - Dbg.Assert(!String.IsNullOrEmpty(ContainerId), "ContainerId has to be set."); + Dbg.Assert(!string.IsNullOrEmpty(ContainerId), "ContainerId has to be set."); ContainerConnectionInfo connectionInfo = null; diff --git a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs index da7b5f03e..4fc242974 100644 --- a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs @@ -121,7 +121,7 @@ namespace Microsoft.PowerShell.Commands private bool FindJobsMatchingByNameHelper(List matches, IList jobsToSearch, string name, Hashtable duplicateDetector, bool recurse, bool writeobject, bool checkIfJobCanBeRemoved) { - Dbg.Assert(!String.IsNullOrEmpty(name), "Caller should ensure that name is not null or empty"); + Dbg.Assert(!string.IsNullOrEmpty(name), "Caller should ensure that name is not null or empty"); bool jobFound = false; diff --git a/src/System.Management.Automation/engine/remoting/commands/StartJob.cs b/src/System.Management.Automation/engine/remoting/commands/StartJob.cs index 0d5d8b691..c2447a0fb 100644 --- a/src/System.Management.Automation/engine/remoting/commands/StartJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/StartJob.cs @@ -95,7 +95,7 @@ namespace Microsoft.PowerShell.Commands set { - if (!String.IsNullOrEmpty(value)) + if (!string.IsNullOrEmpty(value)) { _name = value; } diff --git a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs index fa6221f02..c807e91ad 100644 --- a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs +++ b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs @@ -177,7 +177,7 @@ namespace Microsoft.PowerShell.Commands _throttleManager.ThrottleComplete += new EventHandler(HandleThrottleComplete); - if (String.IsNullOrEmpty(ConfigurationName)) + if (string.IsNullOrEmpty(ConfigurationName)) { if ((ParameterSetName == NewPSSessionCommand.ComputerNameParameterSet) || (ParameterSetName == NewPSSessionCommand.UriParameterSet)) @@ -488,11 +488,11 @@ namespace Microsoft.PowerShell.Commands else { errorDetails = "[" + host + "] "; - if (!String.IsNullOrEmpty(transException.Message)) + if (!string.IsNullOrEmpty(transException.Message)) { errorDetails += transException.Message; } - else if (!String.IsNullOrEmpty(transException.TransportMessage)) + else if (!string.IsNullOrEmpty(transException.TransportMessage)) { errorDetails += transException.TransportMessage; } diff --git a/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs b/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs index 7c030dfb8..9471b613d 100644 --- a/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs +++ b/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs @@ -502,7 +502,7 @@ namespace System.Management.Automation.Remoting // if (isFirstConnection) { - if (String.IsNullOrEmpty(networkCredential.UserName)) + if (string.IsNullOrEmpty(networkCredential.UserName)) { throw new PSDirectException( PSRemotingErrorInvariants.FormatResourceString(RemotingErrorIdStrings.InvalidUsername)); @@ -520,13 +520,13 @@ namespace System.Management.Automation.Remoting if (isFirstConnection) { - if (String.IsNullOrEmpty(networkCredential.Domain)) + if (string.IsNullOrEmpty(networkCredential.Domain)) { networkCredential.Domain = "localhost"; } - bool emptyPassword = String.IsNullOrEmpty(networkCredential.Password); - bool emptyConfiguration = String.IsNullOrEmpty(configurationName); + bool emptyPassword = string.IsNullOrEmpty(networkCredential.Password); + bool emptyConfiguration = string.IsNullOrEmpty(configurationName); byte[] domain = Encoding.Unicode.GetBytes(networkCredential.Domain); byte[] userName = Encoding.Unicode.GetBytes(networkCredential.UserName); diff --git a/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs b/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs index 0ec20cbb2..71aba8fb5 100644 --- a/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs +++ b/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs @@ -1206,7 +1206,7 @@ namespace System.Management.Automation.Remoting string appDomainName, string containerObRoot) { - if (String.IsNullOrEmpty(containerObRoot)) + if (string.IsNullOrEmpty(containerObRoot)) { throw new PSArgumentNullException("containerObRoot"); } diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index 9979c57bb..e41e5137a 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -1114,7 +1114,7 @@ namespace System.Management.Automation.Runspaces private string ResolveShellUri(string shell) { string resolvedShellUri = shell; - if (String.IsNullOrEmpty(resolvedShellUri)) + if (string.IsNullOrEmpty(resolvedShellUri)) { resolvedShellUri = DefaultShellUri; } @@ -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; } @@ -1232,7 +1232,7 @@ namespace System.Management.Automation.Runspaces // default appname is WSMan _appName = appName; - if (String.IsNullOrEmpty(_appName)) + if (string.IsNullOrEmpty(_appName)) { _appName = s_defaultAppName; } @@ -1968,7 +1968,7 @@ namespace System.Management.Automation.Runspaces ValidatePortInRange(port); this.Port = (port != 0) ? port : DefaultPort; - this.Subsystem = (String.IsNullOrEmpty(subsystem)) ? DefaultSubsystem : subsystem; + this.Subsystem = (string.IsNullOrEmpty(subsystem)) ? DefaultSubsystem : subsystem; } #endregion @@ -3147,7 +3147,7 @@ namespace System.Management.Automation.Runspaces this.RunAsAdmin = runAsAdmin; this.ConfigurationName = configurationName; - Dbg.Assert(!String.IsNullOrEmpty(containerId), "containerId input cannot be empty."); + Dbg.Assert(!string.IsNullOrEmpty(containerId), "containerId input cannot be empty."); GetContainerProperties(); } diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteHost.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteHost.cs index c2d8c43f8..125fba873 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteHost.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteHost.cs @@ -334,7 +334,7 @@ namespace System.Management.Automation.Remoting /// executed. internal Collection PerformSecurityChecksOnHostMessage(string computerName) { - Dbg.Assert(!String.IsNullOrEmpty(computerName), + Dbg.Assert(!string.IsNullOrEmpty(computerName), "Computer Name must be passed for use in warning messages"); _computerName = computerName; Collection prerequisiteCalls = new Collection(); diff --git a/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs b/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs index 2c42fc8b9..5daaf3a53 100644 --- a/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs +++ b/src/System.Management.Automation/engine/remoting/common/psstreamobject.cs @@ -392,7 +392,7 @@ namespace System.Management.Automation.Remoting.Internal { // if we get a base InformationRecord object, check if the computerName is // populated in the Source field - if (!String.IsNullOrEmpty(informationRecord.Source)) + if (!string.IsNullOrEmpty(informationRecord.Source)) { string computerName; Guid jobInstanceId; diff --git a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs index 9d9fd7792..3d32f9008 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs @@ -681,7 +681,7 @@ namespace System.Management.Automation.Remoting string assemblyPath; if (!Path.IsPathRooted(assemblyName)) { - if (!String.IsNullOrEmpty(applicationBase) && Directory.Exists(applicationBase)) + if (!string.IsNullOrEmpty(applicationBase) && Directory.Exists(applicationBase)) { assemblyPath = Path.Combine(applicationBase, assemblyName); } @@ -1038,7 +1038,7 @@ namespace System.Management.Automation.Remoting { string value = obj as string; - if (!String.IsNullOrEmpty(value)) + if (!string.IsNullOrEmpty(value)) { try { @@ -1069,7 +1069,7 @@ namespace System.Management.Automation.Remoting { string value = obj as string; - if (!String.IsNullOrEmpty(value)) + if (!string.IsNullOrEmpty(value)) { try { @@ -1100,7 +1100,7 @@ namespace System.Management.Automation.Remoting { string value = obj as string; - if (!String.IsNullOrEmpty(value)) + if (!string.IsNullOrEmpty(value)) { try { @@ -1810,7 +1810,7 @@ namespace System.Management.Automation.Remoting foreach (string roleCapability in roleCapabilities) { string roleCapabilityPath = GetRoleCapabilityPath(roleCapability); - if (String.IsNullOrEmpty(roleCapabilityPath)) + if (string.IsNullOrEmpty(roleCapabilityPath)) { string message = StringUtil.Format(RemotingErrorIdStrings.CouldNotFindRoleCapability, roleCapability, roleCapability + PSRCExtension); PSInvalidOperationException ioe = new PSInvalidOperationException(message); @@ -1965,7 +1965,7 @@ namespace System.Management.Automation.Remoting bool providerVisibilityApplied = IsNonDefaultVisibilitySpecified(ConfigFileConstants.VisibleProviders); bool processDefaultSessionStateVisibility = false; - if (!String.IsNullOrEmpty(initialSessionState)) + if (!string.IsNullOrEmpty(initialSessionState)) { sessionType = (SessionType)Enum.Parse(typeof(SessionType), initialSessionState, true); @@ -2015,7 +2015,7 @@ namespace System.Management.Automation.Remoting System.Collections.Generic.HashSet addedProviders = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (string provider in providers) { - if (!String.IsNullOrEmpty(provider)) + if (!string.IsNullOrEmpty(provider)) { // Look up providers from provider name including wildcards. var providersFound = iss.Providers.LookUpByName(provider); @@ -2160,7 +2160,7 @@ namespace System.Management.Automation.Remoting { foreach (string alias in aliases) { - if (!String.IsNullOrEmpty(alias)) + if (!string.IsNullOrEmpty(alias)) { bool found = false; @@ -2271,7 +2271,7 @@ namespace System.Management.Automation.Remoting { foreach (string type in types) { - if (!String.IsNullOrEmpty(type)) + if (!string.IsNullOrEmpty(type)) { iss.Types.Add(new SessionStateTypeEntry(type)); } @@ -2288,7 +2288,7 @@ namespace System.Management.Automation.Remoting { foreach (string format in formats) { - if (!String.IsNullOrEmpty(format)) + if (!string.IsNullOrEmpty(format)) { iss.Formats.Add(new SessionStateFormatEntry(format)); } @@ -2333,7 +2333,7 @@ namespace System.Management.Automation.Remoting { foreach (string script in startupScripts) { - if (!String.IsNullOrEmpty(script)) + if (!string.IsNullOrEmpty(script)) { iss.StartupScripts.Add(script); } @@ -2475,7 +2475,7 @@ namespace System.Management.Automation.Remoting // If it's just a string, this is a visible command string command = commandObject as string; - if (!String.IsNullOrEmpty(command)) + if (!string.IsNullOrEmpty(command)) { ProcessVisibleCommand(iss, command, commandModuleNames); } @@ -2527,7 +2527,7 @@ namespace System.Management.Automation.Remoting if ((commandName == null) || (parameters == null)) { string hashtableKey = commandName; - if (String.IsNullOrEmpty(hashtableKey)) + if (string.IsNullOrEmpty(hashtableKey)) { IEnumerator errorKey = commandModification.Keys.GetEnumerator(); errorKey.MoveNext(); @@ -2578,7 +2578,7 @@ namespace System.Management.Automation.Remoting foreach (string parameterModificationValue in TryGetStringArray(parameter[parameterModification])) { - if (!String.IsNullOrEmpty(parameterModificationValue)) + if (!string.IsNullOrEmpty(parameterModificationValue)) { currentParameterModificationValue.Add(parameterModificationValue); } @@ -2632,14 +2632,14 @@ namespace System.Management.Automation.Remoting { string name = TryGetValue(alias, ConfigFileConstants.AliasNameToken); - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { return null; } string value = TryGetValue(alias, ConfigFileConstants.AliasValueToken); - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { return null; } @@ -2650,7 +2650,7 @@ namespace System.Management.Automation.Remoting string optionsString = TryGetValue(alias, ConfigFileConstants.AliasOptionsToken); - if (!String.IsNullOrEmpty(optionsString)) + if (!string.IsNullOrEmpty(optionsString)) { options = (ScopedItemOptions)Enum.Parse(typeof(ScopedItemOptions), optionsString, true); } @@ -2672,14 +2672,14 @@ namespace System.Management.Automation.Remoting { string name = TryGetValue(function, ConfigFileConstants.FunctionNameToken); - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { return null; } string value = TryGetValue(function, ConfigFileConstants.FunctionValueToken); - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { return null; } @@ -2688,7 +2688,7 @@ namespace System.Management.Automation.Remoting string optionsString = TryGetValue(function, ConfigFileConstants.FunctionOptionsToken); - if (!String.IsNullOrEmpty(optionsString)) + if (!string.IsNullOrEmpty(optionsString)) { options = (ScopedItemOptions)Enum.Parse(typeof(ScopedItemOptions), optionsString, true); } @@ -2712,14 +2712,14 @@ namespace System.Management.Automation.Remoting { string name = TryGetValue(variable, ConfigFileConstants.VariableNameToken); - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { return null; } string value = TryGetValue(variable, ConfigFileConstants.VariableValueToken); - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { return null; } @@ -2730,7 +2730,7 @@ namespace System.Management.Automation.Remoting string optionsString = TryGetValue(variable, ConfigFileConstants.AliasOptionsToken); - if (!String.IsNullOrEmpty(optionsString)) + if (!string.IsNullOrEmpty(optionsString)) { options = (ScopedItemOptions)Enum.Parse(typeof(ScopedItemOptions), optionsString, true); } diff --git a/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs b/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs index feb4860d9..95e0de32a 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/PSSessionConfigurationData.cs @@ -76,7 +76,7 @@ namespace System.Management.Automation.Remoting { PSSessionConfigurationData configuration = new PSSessionConfigurationData(); - if (String.IsNullOrEmpty(configurationData)) return configuration; + if (string.IsNullOrEmpty(configurationData)) return configuration; configurationData = Unescape(configurationData); diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs index ccc70eae3..141cc4978 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs @@ -240,7 +240,7 @@ namespace System.Management.Automation.Remoting return; } - if (String.IsNullOrEmpty(extraInfo)) + if (string.IsNullOrEmpty(extraInfo)) { ReportOperationComplete( requestDetails, diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs index fa350fb13..b8d8a3c96 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs @@ -904,7 +904,7 @@ namespace System.Management.Automation.Remoting.Client internal override void ConnectAsync() { Dbg.Assert(!isClosed, "object already disposed"); - Dbg.Assert(!String.IsNullOrEmpty(ConnectionInfo.ShellUri), "shell uri cannot be null or empty."); + Dbg.Assert(!string.IsNullOrEmpty(ConnectionInfo.ShellUri), "shell uri cannot be null or empty."); ReceivedDataCollection.PrepareForStreamConnect(); // additional content with connect shell call. Negotiation and connect related messages @@ -1028,7 +1028,7 @@ namespace System.Management.Automation.Remoting.Client internal override void CreateAsync() { Dbg.Assert(!isClosed, "object already disposed"); - Dbg.Assert(!String.IsNullOrEmpty(ConnectionInfo.ShellUri), "shell uri cannot be null or empty."); + Dbg.Assert(!string.IsNullOrEmpty(ConnectionInfo.ShellUri), "shell uri cannot be null or empty."); Dbg.Assert(WSManAPIData != null, "WSManApiData should always be created before session creation."); List shellOptions = new List(WSManAPIData.CommonOptionSet); diff --git a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs index 1fe97497c..b034bf902 100644 --- a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs +++ b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs @@ -760,7 +760,7 @@ namespace System.Management.Automation.Remoting DISCPowerShellConfiguration discProvider = null; - if (String.IsNullOrEmpty(configurationData.ConfigFilePath)) + if (string.IsNullOrEmpty(configurationData.ConfigFilePath)) { _sessionConfigProvider = configurationData.CreateEndPointConfigurationInstance(); } diff --git a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs index fed66576e..d9938bd5e 100644 --- a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs +++ b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs @@ -1836,7 +1836,7 @@ namespace System.Management.Automation int i = 0; while (e != null && i++ < 10) { - if (!String.IsNullOrEmpty(e.StackTrace)) + if (!string.IsNullOrEmpty(e.StackTrace)) { stack = e.StackTrace; } @@ -2367,7 +2367,7 @@ namespace System.Management.Automation FileInfo file = obj as FileInfo; string filePath = file != null ? file.FullName : PSObject.ToStringParser(context, obj); - if (String.IsNullOrEmpty(filePath)) + if (string.IsNullOrEmpty(filePath)) { throw InterpreterError.NewInterpreterException(filePath, typeof(RuntimeException), errorExtent, "InvalidFilenameOption", ParserStrings.InvalidFilenameOption); diff --git a/src/System.Management.Automation/engine/serialization.cs b/src/System.Management.Automation/engine/serialization.cs index 0574424d7..07e208550 100644 --- a/src/System.Management.Automation/engine/serialization.cs +++ b/src/System.Management.Automation/engine/serialization.cs @@ -7188,7 +7188,7 @@ namespace Microsoft.PowerShell string userName = GetPropertyValue(pso, "UserName"); System.Security.SecureString password = GetPropertyValue(pso, "Password"); - if (String.IsNullOrEmpty(userName)) + if (string.IsNullOrEmpty(userName)) { return PSCredential.Empty; } diff --git a/src/System.Management.Automation/help/AliasHelpInfo.cs b/src/System.Management.Automation/help/AliasHelpInfo.cs index 732573d42..37375e385 100644 --- a/src/System.Management.Automation/help/AliasHelpInfo.cs +++ b/src/System.Management.Automation/help/AliasHelpInfo.cs @@ -29,12 +29,12 @@ namespace System.Management.Automation this.ForwardHelpCategory = HelpCategory.Cmdlet | HelpCategory.Function | HelpCategory.ExternalScript | HelpCategory.ScriptCommand | HelpCategory.Filter | HelpCategory.Workflow; - if (!String.IsNullOrEmpty(aliasInfo.Name)) + if (!string.IsNullOrEmpty(aliasInfo.Name)) { Name = aliasInfo.Name.Trim(); } - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { Synopsis = name.Trim(); } @@ -100,7 +100,7 @@ namespace System.Management.Automation AliasHelpInfo aliasHelpInfo = new AliasHelpInfo(aliasInfo); - if (String.IsNullOrEmpty(aliasHelpInfo.Name)) + if (string.IsNullOrEmpty(aliasHelpInfo.Name)) return null; aliasHelpInfo.AddCommonHelpProperties(); diff --git a/src/System.Management.Automation/help/AliasHelpProvider.cs b/src/System.Management.Automation/help/AliasHelpProvider.cs index 23c92b3c3..0280f7736 100644 --- a/src/System.Management.Automation/help/AliasHelpProvider.cs +++ b/src/System.Management.Automation/help/AliasHelpProvider.cs @@ -306,10 +306,10 @@ namespace System.Management.Automation private static bool Match(string target, string pattern) { - if (String.IsNullOrEmpty(pattern)) + if (string.IsNullOrEmpty(pattern)) return true; - if (String.IsNullOrEmpty(target)) + if (string.IsNullOrEmpty(target)) target = string.Empty; WildcardPattern matcher = WildcardPattern.Get(pattern, WildcardOptions.IgnoreCase); diff --git a/src/System.Management.Automation/help/CommandHelpProvider.cs b/src/System.Management.Automation/help/CommandHelpProvider.cs index 38fa8e3b9..fcaa8ee36 100644 --- a/src/System.Management.Automation/help/CommandHelpProvider.cs +++ b/src/System.Management.Automation/help/CommandHelpProvider.cs @@ -103,7 +103,7 @@ namespace System.Management.Automation moduleName = commandInfo.Module.Name; moduleDir = commandInfo.Module.ModuleBase; - if (!String.IsNullOrEmpty(commandInfo.Prefix)) + if (!string.IsNullOrEmpty(commandInfo.Prefix)) { testWithoutPrefix = true; cmdNameWithoutPrefix = Microsoft.PowerShell.Commands.ModuleCmdletBase.RemovePrefixFromCommandName(commandInfo.Name, commandInfo.Prefix); @@ -158,7 +158,7 @@ namespace System.Management.Automation helpFile = MUIFileSearcher.LocateFile(helpFileToFind, searchPaths); - if (!String.IsNullOrEmpty(helpFile)) + if (!string.IsNullOrEmpty(helpFile)) { if (!_helpFiles.Contains(helpFile)) { @@ -225,7 +225,7 @@ namespace System.Management.Automation { // Try load the help file specified by CmdletInfo.HelpFile property helpFile = FindHelpFile(cmdletInfo); - if (!String.IsNullOrEmpty(helpFile) && !_helpFiles.Contains(helpFile)) + if (!string.IsNullOrEmpty(helpFile) && !_helpFiles.Contains(helpFile)) { LoadHelpFile(helpFile, cmdletInfo.ModuleName, cmdletInfo.Name, reportErrors); } @@ -237,7 +237,7 @@ namespace System.Management.Automation { // Try load the help file specified by FunctionInfo.HelpFile property helpFile = functionInfo.HelpFile; - if (!String.IsNullOrEmpty(helpFile)) + if (!string.IsNullOrEmpty(helpFile)) { if (!_helpFiles.Contains(helpFile)) { @@ -272,7 +272,7 @@ namespace System.Management.Automation result = sb.GetHelpInfo(_context, commandInfo, searchOnlyContent, HelpSystem.ScriptBlockTokenCache, out helpFile, out helpUriFromDotLink); - if (!String.IsNullOrEmpty(helpUriFromDotLink)) + if (!string.IsNullOrEmpty(helpUriFromDotLink)) { try { @@ -295,7 +295,7 @@ namespace System.Management.Automation } } - if (!String.IsNullOrEmpty(helpFile) && !InternalTestHooks.BypassOnlineHelpRetrieval) + if (!string.IsNullOrEmpty(helpFile) && !InternalTestHooks.BypassOnlineHelpRetrieval) { if (!_helpFiles.Contains(helpFile)) { @@ -321,24 +321,24 @@ namespace System.Management.Automation Collection searchPaths = new Collection() { userHomeHelpPath }; - if (!String.IsNullOrEmpty(moduleDir)) + if (!string.IsNullOrEmpty(moduleDir)) { searchPaths.Add(moduleDir); } - if (!String.IsNullOrEmpty(userHomeHelpPath) && !String.IsNullOrEmpty(moduleName)) + if (!string.IsNullOrEmpty(userHomeHelpPath) && !string.IsNullOrEmpty(moduleName)) { searchPaths.Add(Path.Combine(userHomeHelpPath, moduleName)); } - if (!String.IsNullOrEmpty(moduleName) && !String.IsNullOrEmpty(moduleDir)) + if (!string.IsNullOrEmpty(moduleName) && !string.IsNullOrEmpty(moduleDir)) { // Search for -Help.xml under ModuleBase folder string helpFileToFind = moduleName + "-Help.xml"; result = GetHelpInfoFromHelpFile(commandInfo, helpFileToFind, searchPaths, reportErrors, out helpFile); } - if (result == null && !String.IsNullOrEmpty(nestedModulePath)) + if (result == null && !string.IsNullOrEmpty(nestedModulePath)) { // Search for -Help.xml under both ModuleBase and NestedModule's directory searchPaths.Add(Path.GetDirectoryName(nestedModulePath)); @@ -348,7 +348,7 @@ namespace System.Management.Automation } // Set the HelpFile property to the file that contains the help content - if (result != null && !String.IsNullOrEmpty(helpFile)) + if (result != null && !string.IsNullOrEmpty(helpFile)) { if (isCmdlet) { @@ -385,11 +385,11 @@ namespace System.Management.Automation { if (isScriptCommand && result.GetUriForOnlineHelp() == null) { - if (!String.IsNullOrEmpty(commandInfo.CommandMetadata.HelpUri)) + if (!string.IsNullOrEmpty(commandInfo.CommandMetadata.HelpUri)) { DefaultCommandHelpObjectBuilder.AddRelatedLinksProperties(result.FullHelp, commandInfo.CommandMetadata.HelpUri); } - else if (!String.IsNullOrEmpty(helpUri)) + else if (!string.IsNullOrEmpty(helpUri)) { DefaultCommandHelpObjectBuilder.AddRelatedLinksProperties(result.FullHelp, helpUri); } @@ -445,7 +445,7 @@ namespace System.Management.Automation HelpInfo helpInfo = GetHelpInfo(current, true, false); string helpName = GetHelpName(current); - if (helpInfo != null && !String.IsNullOrEmpty(helpName)) + if (helpInfo != null && !string.IsNullOrEmpty(helpName)) { if (helpInfo.ForwardHelpCategory == helpRequest.HelpCategory && helpInfo.ForwardTarget.Equals(helpRequest.Target, StringComparison.OrdinalIgnoreCase)) @@ -542,7 +542,7 @@ namespace System.Management.Automation // let caller take care of getting help info in a different way // like "get-command -syntax" - if (String.IsNullOrEmpty(location)) + if (string.IsNullOrEmpty(location)) { s_tracer.WriteLine("Unable to load file {0}", helpFileToLoad); } @@ -572,7 +572,7 @@ namespace System.Management.Automation // Get the help file name from the cmdlet metadata string helpFile = cmdletInfo.HelpFile; - if (String.IsNullOrEmpty(helpFile)) + if (string.IsNullOrEmpty(helpFile)) { if (cmdletInfo.Module != null) { @@ -604,13 +604,13 @@ namespace System.Management.Automation // Make sure that the assembly name contains more than '.ni.dll' string assemblyName = helpFile.Replace(".ni.dll-Help.xml", string.Empty); - if (!String.IsNullOrEmpty(assemblyName)) + if (!string.IsNullOrEmpty(assemblyName)) { // In the first try, we remove '.ni' from the assembly name and we attempt to find the corresponding help file. string helpFileName = cmdletInfo.HelpFile.Replace(".ni.dll-Help.xml", ".dll-Help.xml"); location = GetHelpFile(helpFileName, cmdletInfo); - if (String.IsNullOrEmpty(location)) + if (string.IsNullOrEmpty(location)) { // If the help file could not be found, then it is possible that the actual assembly name is something like // .ni.dll, e.g., MyAssembly.ni.dll, so let's try to find the original help file in the cmdlet metadata. @@ -757,7 +757,7 @@ namespace System.Management.Automation if (userDefinedHelpData == null) return; - if (String.IsNullOrEmpty(userDefinedHelpData.Name)) + if (string.IsNullOrEmpty(userDefinedHelpData.Name)) return; HelpInfo helpInfo = GetFromCommandCache(mshSnapInId, userDefinedHelpData.Name, HelpCategory.Cmdlet); @@ -1071,7 +1071,7 @@ namespace System.Management.Automation HelpInfo helpInfo = GetHelpInfo(current, !decoratedSearch, searchOnlyContent); string helpName = GetHelpName(current); - if (helpInfo != null && !String.IsNullOrEmpty(helpName)) + if (helpInfo != null && !string.IsNullOrEmpty(helpName)) { if (!SessionState.IsVisible(helpRequest.CommandOrigin, current)) { @@ -1128,7 +1128,7 @@ namespace System.Management.Automation HelpInfo helpInfo = GetHelpInfo(current, !decoratedSearch, searchOnlyContent); string helpName = GetHelpName(current); - if (helpInfo != null && !String.IsNullOrEmpty(helpName)) + if (helpInfo != null && !string.IsNullOrEmpty(helpName)) { if (hashtable.ContainsKey(helpName)) continue; @@ -1201,10 +1201,10 @@ namespace System.Management.Automation private static bool Match(string target, string pattern) { - if (String.IsNullOrEmpty(pattern)) + if (string.IsNullOrEmpty(pattern)) return true; - if (String.IsNullOrEmpty(target)) + if (string.IsNullOrEmpty(target)) target = string.Empty; WildcardPattern matcher = WildcardPattern.Get(pattern, WildcardOptions.IgnoreCase); @@ -1403,7 +1403,7 @@ namespace System.Management.Automation userDefinedHelpData._name = name; - if (String.IsNullOrEmpty(userDefinedHelpData.Name)) + if (string.IsNullOrEmpty(userDefinedHelpData.Name)) return null; return userDefinedHelpData; diff --git a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs index 58000675e..358543a27 100644 --- a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs +++ b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs @@ -710,7 +710,7 @@ namespace System.Management.Automation.Help /// private static void AddRemarksProperties(PSObject obj, string cmdletName, string helpUri) { - if (String.IsNullOrEmpty(helpUri)) + if (string.IsNullOrEmpty(helpUri)) { obj.Properties.Add(new PSNoteProperty("remarks", StringUtil.Format(HelpDisplayStrings.GetLatestHelpContentWithoutHelpUri, cmdletName))); } @@ -727,7 +727,7 @@ namespace System.Management.Automation.Help /// internal static void AddRelatedLinksProperties(PSObject obj, string relatedLink) { - if (!String.IsNullOrEmpty(relatedLink)) + if (!string.IsNullOrEmpty(relatedLink)) { PSObject navigationLinkObj = new PSObject(); @@ -899,7 +899,7 @@ namespace System.Management.Automation.Help private static bool HasHelpInfoUri(PSModuleInfo module, string moduleName) { // The core module is really a SnapIn, so module will be null - if (!String.IsNullOrEmpty(moduleName) && moduleName.Equals(InitialSessionState.CoreModule, StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(moduleName) && moduleName.Equals(InitialSessionState.CoreModule, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -909,7 +909,7 @@ namespace System.Management.Automation.Help return false; } - return !String.IsNullOrEmpty(module.HelpInfoUri); + return !string.IsNullOrEmpty(module.HelpInfoUri); } } } diff --git a/src/System.Management.Automation/help/DscResourceHelpProvider.cs b/src/System.Management.Automation/help/DscResourceHelpProvider.cs index 40ee584c2..5d79a28bf 100644 --- a/src/System.Management.Automation/help/DscResourceHelpProvider.cs +++ b/src/System.Management.Automation/help/DscResourceHelpProvider.cs @@ -138,13 +138,13 @@ namespace System.Management.Automation { moduleName = current.Module.Name; } - else if (!String.IsNullOrEmpty(moduleDir)) + else if (!string.IsNullOrEmpty(moduleDir)) { string[] splitPath = moduleDir.Split(Utils.Separators.Backslash); moduleName = splitPath[splitPath.Length - 1]; } - if (!String.IsNullOrEmpty(moduleName) && !String.IsNullOrEmpty(moduleDir)) + if (!string.IsNullOrEmpty(moduleName) && !string.IsNullOrEmpty(moduleDir)) { string helpFileToFind = moduleName + "-Help.xml"; @@ -178,7 +178,7 @@ namespace System.Management.Automation /// internal static bool IsMamlHelp(string helpFile, XmlNode helpItemsNode) { - Debug.Assert(!String.IsNullOrEmpty(helpFile), "helpFile cannot be null."); + Debug.Assert(!string.IsNullOrEmpty(helpFile), "helpFile cannot be null."); if (helpFile.EndsWith(".maml", StringComparison.OrdinalIgnoreCase)) return true; @@ -210,7 +210,7 @@ namespace System.Management.Automation if (!File.Exists(helpFile)) return null; - if (!String.IsNullOrEmpty(helpFile)) + if (!string.IsNullOrEmpty(helpFile)) { //Load the help file only once. Then use it from the cache. if (!_helpFiles.Contains(helpFile)) @@ -298,8 +298,8 @@ namespace System.Management.Automation /// private void LoadHelpFile(string helpFile, string helpFileIdentifier) { - Dbg.Assert(!String.IsNullOrEmpty(helpFile), "HelpFile cannot be null or empty."); - Dbg.Assert(!String.IsNullOrEmpty(helpFileIdentifier), "helpFileIdentifier cannot be null or empty."); + Dbg.Assert(!string.IsNullOrEmpty(helpFile), "HelpFile cannot be null or empty."); + Dbg.Assert(!string.IsNullOrEmpty(helpFileIdentifier), "helpFileIdentifier cannot be null or empty."); XmlDocument doc = InternalDeserializer.LoadUnsafeXmlDocument( new FileInfo(helpFile), diff --git a/src/System.Management.Automation/help/HelpFileHelpInfo.cs b/src/System.Management.Automation/help/HelpFileHelpInfo.cs index 34cdfb36e..e87922e07 100644 --- a/src/System.Management.Automation/help/HelpFileHelpInfo.cs +++ b/src/System.Management.Automation/help/HelpFileHelpInfo.cs @@ -91,12 +91,12 @@ namespace System.Management.Automation /// HelpFileHelpInfo object created based on information provided. internal static HelpFileHelpInfo GetHelpInfo(string name, string text, string filename) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) return null; HelpFileHelpInfo helpfileHelpInfo = new HelpFileHelpInfo(name, text, filename); - if (String.IsNullOrEmpty(helpfileHelpInfo.Name)) + if (string.IsNullOrEmpty(helpfileHelpInfo.Name)) return null; helpfileHelpInfo.AddCommonHelpProperties(); diff --git a/src/System.Management.Automation/help/HelpFileHelpProvider.cs b/src/System.Management.Automation/help/HelpFileHelpProvider.cs index a8b6ad04f..415c82c5c 100644 --- a/src/System.Management.Automation/help/HelpFileHelpProvider.cs +++ b/src/System.Management.Automation/help/HelpFileHelpProvider.cs @@ -309,7 +309,7 @@ namespace System.Management.Automation string name = fileName.Substring(0, fileName.Length - 9 /* ".help.txt".Length */); - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) return null; HelpInfo helpInfo = GetCache(path); diff --git a/src/System.Management.Automation/help/HelpRequest.cs b/src/System.Management.Automation/help/HelpRequest.cs index ece4bf87e..2c2b63d68 100644 --- a/src/System.Management.Automation/help/HelpRequest.cs +++ b/src/System.Management.Automation/help/HelpRequest.cs @@ -123,9 +123,9 @@ namespace System.Management.Automation /// internal void Validate() { - if (String.IsNullOrEmpty(Target) + if (string.IsNullOrEmpty(Target) && HelpCategory == HelpCategory.None - && String.IsNullOrEmpty(Provider) + && string.IsNullOrEmpty(Provider) && Component == null && Role == null && Functionality == null @@ -136,9 +136,9 @@ namespace System.Management.Automation return; } - if (String.IsNullOrEmpty(Target)) + if (string.IsNullOrEmpty(Target)) { - if (!String.IsNullOrEmpty(Provider) && + if (!string.IsNullOrEmpty(Provider) && (HelpCategory == HelpCategory.None || HelpCategory == HelpCategory.Provider) ) { diff --git a/src/System.Management.Automation/help/HelpSystem.cs b/src/System.Management.Automation/help/HelpSystem.cs index b629f6207..c5b46df1c 100644 --- a/src/System.Management.Automation/help/HelpSystem.cs +++ b/src/System.Management.Automation/help/HelpSystem.cs @@ -289,7 +289,7 @@ namespace System.Management.Automation _lastHelpCategory = helpRequest.HelpCategory; - if (String.IsNullOrEmpty(helpRequest.Target)) + if (string.IsNullOrEmpty(helpRequest.Target)) { HelpInfo helpInfo = GetDefaultHelp(); @@ -629,7 +629,7 @@ namespace System.Management.Automation { Assembly providerAssembly = null; - if (String.IsNullOrEmpty(providerInfo.AssemblyName)) + if (string.IsNullOrEmpty(providerInfo.AssemblyName)) { providerAssembly = Assembly.GetExecutingAssembly(); } diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs index 1be35ce9d..2ac4bed05 100644 --- a/src/System.Management.Automation/help/MUIFileSearcher.cs +++ b/src/System.Management.Automation/help/MUIFileSearcher.cs @@ -93,11 +93,11 @@ namespace System.Management.Automation /// private void SearchForFiles() { - if (String.IsNullOrEmpty(this.Target)) + if (string.IsNullOrEmpty(this.Target)) return; string pattern = Path.GetFileName(this.Target); - if (String.IsNullOrEmpty(pattern)) + if (string.IsNullOrEmpty(pattern)) return; Collection normalizedSearchPaths = NormalizeSearchPaths(this.Target, this.SearchPaths); @@ -208,7 +208,7 @@ namespace System.Management.Automation List cultureNameList = new List(); CultureInfo culture = CultureInfo.CurrentUICulture; - while (culture != null && !String.IsNullOrEmpty(culture.Name)) + while (culture != null && !string.IsNullOrEmpty(culture.Name)) { cultureNameList.Add(culture.Name); culture = culture.Parent; @@ -260,7 +260,7 @@ namespace System.Management.Automation // step 1: if target has path attached, directly locate // file from there. - if (!String.IsNullOrEmpty(target) && !String.IsNullOrEmpty(Path.GetDirectoryName(target))) + if (!string.IsNullOrEmpty(target) && !string.IsNullOrEmpty(Path.GetDirectoryName(target))) { string directory = Path.GetDirectoryName(target); diff --git a/src/System.Management.Automation/help/MamlClassHelpInfo.cs b/src/System.Management.Automation/help/MamlClassHelpInfo.cs index 3c30b5a0e..36d337474 100644 --- a/src/System.Management.Automation/help/MamlClassHelpInfo.cs +++ b/src/System.Management.Automation/help/MamlClassHelpInfo.cs @@ -56,7 +56,7 @@ namespace System.Management.Automation { MamlClassHelpInfo mamlClassHelpInfo = new MamlClassHelpInfo(xmlNode, helpCategory); - if (String.IsNullOrEmpty(mamlClassHelpInfo.Name)) + if (string.IsNullOrEmpty(mamlClassHelpInfo.Name)) return null; mamlClassHelpInfo.AddCommonHelpProperties(); diff --git a/src/System.Management.Automation/help/MamlCommandHelpInfo.cs b/src/System.Management.Automation/help/MamlCommandHelpInfo.cs index 0602e04f3..fec209f5e 100644 --- a/src/System.Management.Automation/help/MamlCommandHelpInfo.cs +++ b/src/System.Management.Automation/help/MamlCommandHelpInfo.cs @@ -258,7 +258,7 @@ namespace System.Management.Automation { MamlCommandHelpInfo mamlCommandHelpInfo = new MamlCommandHelpInfo(xmlNode, helpCategory); - if (String.IsNullOrEmpty(mamlCommandHelpInfo.Name)) + if (string.IsNullOrEmpty(mamlCommandHelpInfo.Name)) return null; mamlCommandHelpInfo.AddCommonHelpProperties(); diff --git a/src/System.Management.Automation/help/MamlNode.cs b/src/System.Management.Automation/help/MamlNode.cs index 47442e370..f5c5d53b3 100644 --- a/src/System.Management.Automation/help/MamlNode.cs +++ b/src/System.Management.Automation/help/MamlNode.cs @@ -1019,7 +1019,7 @@ namespace System.Management.Automation WriteMamlInvalidChildNodeError(xmlNode, childNode); } - if (String.IsNullOrEmpty(term)) + if (string.IsNullOrEmpty(term)) return null; PSObject mshObject = new PSObject(); @@ -1226,11 +1226,11 @@ namespace System.Management.Automation /// private static bool IsEmptyLine(string line) { - if (String.IsNullOrEmpty(line)) + if (string.IsNullOrEmpty(line)) return true; string trimedLine = line.Trim(); - if (String.IsNullOrEmpty(trimedLine)) + if (string.IsNullOrEmpty(trimedLine)) return true; return false; diff --git a/src/System.Management.Automation/help/PSClassHelpProvider.cs b/src/System.Management.Automation/help/PSClassHelpProvider.cs index c25da7e36..d1af0a544 100644 --- a/src/System.Management.Automation/help/PSClassHelpProvider.cs +++ b/src/System.Management.Automation/help/PSClassHelpProvider.cs @@ -135,7 +135,7 @@ namespace System.Management.Automation string moduleName = current.Module.Name; string moduleDir = current.Module.ModuleBase; - if (!String.IsNullOrEmpty(moduleName) && !String.IsNullOrEmpty(moduleDir)) + if (!string.IsNullOrEmpty(moduleName) && !string.IsNullOrEmpty(moduleDir)) { string helpFileToFind = moduleName + "-Help.xml"; @@ -146,7 +146,7 @@ namespace System.Management.Automation string externalHelpFile = current.HelpFile; - if (!String.IsNullOrEmpty(externalHelpFile)) + if (!string.IsNullOrEmpty(externalHelpFile)) { FileInfo helpFileInfo = new FileInfo(externalHelpFile); DirectoryInfo dirToSearch = helpFileInfo.Directory; @@ -183,7 +183,7 @@ namespace System.Management.Automation /// internal static bool IsMamlHelp(string helpFile, XmlNode helpItemsNode) { - Debug.Assert(!String.IsNullOrEmpty(helpFile), "helpFile cannot be null."); + Debug.Assert(!string.IsNullOrEmpty(helpFile), "helpFile cannot be null."); if (helpFile.EndsWith(".maml", StringComparison.OrdinalIgnoreCase)) return true; @@ -215,7 +215,7 @@ namespace System.Management.Automation if (!File.Exists(helpFile)) return null; - if (!String.IsNullOrEmpty(helpFile)) + if (!string.IsNullOrEmpty(helpFile)) { //Load the help file only once. Then use it from the cache. if (!_helpFiles.Contains(helpFile)) @@ -303,8 +303,8 @@ namespace System.Management.Automation /// private void LoadHelpFile(string helpFile, string helpFileIdentifier) { - Dbg.Assert(!String.IsNullOrEmpty(helpFile), "HelpFile cannot be null or empty."); - Dbg.Assert(!String.IsNullOrEmpty(helpFileIdentifier), "helpFileIdentifier cannot be null or empty."); + Dbg.Assert(!string.IsNullOrEmpty(helpFile), "HelpFile cannot be null or empty."); + Dbg.Assert(!string.IsNullOrEmpty(helpFileIdentifier), "helpFileIdentifier cannot be null or empty."); XmlDocument doc = InternalDeserializer.LoadUnsafeXmlDocument( new FileInfo(helpFile), diff --git a/src/System.Management.Automation/help/ProviderHelpInfo.cs b/src/System.Management.Automation/help/ProviderHelpInfo.cs index 760037c90..76c2818bd 100644 --- a/src/System.Management.Automation/help/ProviderHelpInfo.cs +++ b/src/System.Management.Automation/help/ProviderHelpInfo.cs @@ -194,7 +194,7 @@ namespace System.Management.Automation /// An mshObject that contains provider-specific commandlet help. internal PSObject GetCmdletHelp(string cmdletName) { - if (String.IsNullOrEmpty(cmdletName)) + if (string.IsNullOrEmpty(cmdletName)) return null; LoadCmdletHelps(); @@ -351,7 +351,7 @@ namespace System.Management.Automation { ProviderHelpInfo providerHelpInfo = new ProviderHelpInfo(xmlNode); - if (String.IsNullOrEmpty(providerHelpInfo.Name)) + if (string.IsNullOrEmpty(providerHelpInfo.Name)) return null; providerHelpInfo.AddCommonHelpProperties(); diff --git a/src/System.Management.Automation/help/ProviderHelpProvider.cs b/src/System.Management.Automation/help/ProviderHelpProvider.cs index d3a1896c7..2a94f2b3b 100644 --- a/src/System.Management.Automation/help/ProviderHelpProvider.cs +++ b/src/System.Management.Automation/help/ProviderHelpProvider.cs @@ -154,7 +154,7 @@ namespace System.Management.Automation string helpFile = providerInfo.HelpFile; - if (String.IsNullOrEmpty(helpFile) || _helpFiles.Contains(helpFile)) + if (string.IsNullOrEmpty(helpFile) || _helpFiles.Contains(helpFile)) { return; } @@ -191,7 +191,7 @@ namespace System.Management.Automation } string location = MUIFileSearcher.LocateFile(helpFileToLoad, searchPaths); - if (String.IsNullOrEmpty(location)) + if (string.IsNullOrEmpty(location)) throw new FileNotFoundException(helpFile); XmlDocument doc = InternalDeserializer.LoadUnsafeXmlDocument( @@ -386,7 +386,7 @@ namespace System.Management.Automation } string providerName = helpRequest.Provider; - if (String.IsNullOrEmpty(providerName)) + if (string.IsNullOrEmpty(providerName)) { providerName = this._sessionState.Path.CurrentLocation.Provider.Name; } diff --git a/src/System.Management.Automation/help/SaveHelpCommand.cs b/src/System.Management.Automation/help/SaveHelpCommand.cs index 7b0aa2209..8b8491356 100644 --- a/src/System.Management.Automation/help/SaveHelpCommand.cs +++ b/src/System.Management.Automation/help/SaveHelpCommand.cs @@ -177,7 +177,7 @@ namespace Microsoft.PowerShell.Commands try { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(HelpDisplayStrings.PathNullOrEmpty)); WriteError(e.ErrorRecord); diff --git a/src/System.Management.Automation/help/SyntaxHelpInfo.cs b/src/System.Management.Automation/help/SyntaxHelpInfo.cs index d2fd95f4b..7678eb522 100644 --- a/src/System.Management.Automation/help/SyntaxHelpInfo.cs +++ b/src/System.Management.Automation/help/SyntaxHelpInfo.cs @@ -47,12 +47,12 @@ namespace System.Management.Automation /// SyntaxHelpInfo object created based on information provided. internal static SyntaxHelpInfo GetHelpInfo(string name, string text, HelpCategory category) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) return null; SyntaxHelpInfo syntaxHelpInfo = new SyntaxHelpInfo(name, text, category); - if (String.IsNullOrEmpty(syntaxHelpInfo.Name)) + if (string.IsNullOrEmpty(syntaxHelpInfo.Name)) return null; syntaxHelpInfo.AddCommonHelpProperties(); diff --git a/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs b/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs index e144077aa..dcc4cb417 100644 --- a/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs +++ b/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs @@ -235,7 +235,7 @@ namespace Microsoft.PowerShell.Commands return; } - if (String.IsNullOrEmpty(module.HelpInfoUri)) + if (string.IsNullOrEmpty(module.HelpInfoUri)) { if (!noErrors) { @@ -464,7 +464,7 @@ namespace Microsoft.PowerShell.Commands /// Module name with globbing. private void ProcessModuleWithGlobbing(string name) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(HelpDisplayStrings.ModuleNameNullOrEmpty)); WriteError(e.ErrorRecord); diff --git a/src/System.Management.Automation/help/UpdatableHelpModuleInfo.cs b/src/System.Management.Automation/help/UpdatableHelpModuleInfo.cs index c70d0e015..57e9409b2 100644 --- a/src/System.Management.Automation/help/UpdatableHelpModuleInfo.cs +++ b/src/System.Management.Automation/help/UpdatableHelpModuleInfo.cs @@ -27,10 +27,10 @@ namespace System.Management.Automation.Help /// HelpInfo URI. internal UpdatableHelpModuleInfo(string name, Guid guid, string path, string uri) { - Debug.Assert(!String.IsNullOrEmpty(name)); + Debug.Assert(!string.IsNullOrEmpty(name)); Debug.Assert(guid != null); - Debug.Assert(!String.IsNullOrEmpty(path)); - Debug.Assert(!String.IsNullOrEmpty(uri)); + Debug.Assert(!string.IsNullOrEmpty(path)); + Debug.Assert(!string.IsNullOrEmpty(uri)); ModuleName = name; _moduleGuid = guid; diff --git a/src/System.Management.Automation/help/UpdatableHelpSystem.cs b/src/System.Management.Automation/help/UpdatableHelpSystem.cs index b1cf5199b..3e6e5166f 100644 --- a/src/System.Management.Automation/help/UpdatableHelpSystem.cs +++ b/src/System.Management.Automation/help/UpdatableHelpSystem.cs @@ -182,7 +182,7 @@ namespace System.Management.Automation.Help /// Progress percentage. internal UpdatableHelpProgressEventArgs(string moduleName, string status, int percent) { - Debug.Assert(!String.IsNullOrEmpty(status)); + Debug.Assert(!string.IsNullOrEmpty(status)); CommandType = UpdatableHelpCommandType.UnknownCommand; ProgressStatus = status; @@ -199,7 +199,7 @@ namespace System.Management.Automation.Help /// Progress percentage. internal UpdatableHelpProgressEventArgs(string moduleName, UpdatableHelpCommandType type, string status, int percent) { - Debug.Assert(!String.IsNullOrEmpty(status)); + Debug.Assert(!string.IsNullOrEmpty(status)); CommandType = type; ProgressStatus = status; @@ -379,7 +379,7 @@ namespace System.Management.Automation.Help /// Resolved URI. private string ResolveUri(string baseUri, bool verbose) { - Debug.Assert(!String.IsNullOrEmpty(baseUri)); + Debug.Assert(!string.IsNullOrEmpty(baseUri)); // Directory.Exists checks if baseUri is a network drive or // a local directory. If baseUri is local, we don't need to resolve it. @@ -558,7 +558,7 @@ namespace System.Management.Automation.Help string uri = pathOverride; string unresolvedUri = document["HelpInfo"]["HelpContentURI"].InnerText; - if (String.IsNullOrEmpty(pathOverride)) + if (string.IsNullOrEmpty(pathOverride)) { if (shouldResolveUri) { @@ -583,7 +583,7 @@ namespace System.Management.Automation.Help UpdatableHelpInfo helpInfo = new UpdatableHelpInfo(unresolvedUri, updatableHelpItem); - if (!String.IsNullOrEmpty(currentCulture)) + if (!string.IsNullOrEmpty(currentCulture)) { WildcardOptions wildcardOptions = WildcardOptions.IgnoreCase | WildcardOptions.CultureInvariant; IEnumerable patternList = SessionStateUtilities.CreateWildcardsFromStrings(new string[1] { currentCulture }, wildcardOptions); @@ -597,7 +597,7 @@ namespace System.Management.Automation.Help } } - if (!String.IsNullOrEmpty(currentCulture) && helpInfo.HelpContentUriCollection.Count == 0) + if (!string.IsNullOrEmpty(currentCulture) && helpInfo.HelpContentUriCollection.Count == 0) { // throw exception throw new UpdatableHelpSystemException("HelpCultureNotSupported", @@ -1497,7 +1497,7 @@ namespace System.Management.Automation.Help { var updatableHelpSetting = Utils.GetPolicySetting(Utils.SystemWideOnlyConfig); string defaultSourcePath = updatableHelpSetting?.DefaultSourcePath; - return String.IsNullOrEmpty(defaultSourcePath) ? null : defaultSourcePath; + return string.IsNullOrEmpty(defaultSourcePath) ? null : defaultSourcePath; } /// diff --git a/src/System.Management.Automation/help/UpdatableHelpUri.cs b/src/System.Management.Automation/help/UpdatableHelpUri.cs index 099fbdbde..88b85bc37 100644 --- a/src/System.Management.Automation/help/UpdatableHelpUri.cs +++ b/src/System.Management.Automation/help/UpdatableHelpUri.cs @@ -20,9 +20,9 @@ namespace System.Management.Automation.Help /// Resolved URI. internal UpdatableHelpUri(string moduleName, Guid moduleGuid, CultureInfo culture, string resolvedUri) { - Debug.Assert(!String.IsNullOrEmpty(moduleName)); + Debug.Assert(!string.IsNullOrEmpty(moduleName)); Debug.Assert(moduleGuid != null); - Debug.Assert(!String.IsNullOrEmpty(resolvedUri)); + Debug.Assert(!string.IsNullOrEmpty(resolvedUri)); ModuleName = moduleName; ModuleGuid = moduleGuid; diff --git a/src/System.Management.Automation/help/UpdateHelpCommand.cs b/src/System.Management.Automation/help/UpdateHelpCommand.cs index ac40dbdac..f93cc74a8 100644 --- a/src/System.Management.Automation/help/UpdateHelpCommand.cs +++ b/src/System.Management.Automation/help/UpdateHelpCommand.cs @@ -263,7 +263,7 @@ namespace Microsoft.PowerShell.Commands // Search for the HelpInfo XML foreach (string path in _path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { PSArgumentException e = new PSArgumentException(StringUtil.Format(HelpDisplayStrings.PathNullOrEmpty)); WriteError(e.ErrorRecord); diff --git a/src/System.Management.Automation/logging/MshLog.cs b/src/System.Management.Automation/logging/MshLog.cs index 26f031def..6ca46c5c7 100644 --- a/src/System.Management.Automation/logging/MshLog.cs +++ b/src/System.Management.Automation/logging/MshLog.cs @@ -117,7 +117,7 @@ namespace System.Management.Automation private static IEnumerable GetLogProvider(LogContext logContext) { System.Diagnostics.Debug.Assert(logContext != null); - System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(logContext.ShellId)); + System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(logContext.ShellId)); return GetLogProvider(logContext.ShellId); } diff --git a/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs b/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs index 21cf361e4..7750555f8 100644 --- a/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs +++ b/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs @@ -42,7 +42,7 @@ namespace System.Management.Automation string source; // In case shellId == null, use the "Default" source. - if (String.IsNullOrEmpty(shellId)) + if (string.IsNullOrEmpty(shellId)) { source = "Default"; } @@ -57,7 +57,7 @@ namespace System.Management.Automation // There may be a situation where ShellId ends with a '.'. // In that case, use the default source. - if (String.IsNullOrEmpty(source)) + if (string.IsNullOrEmpty(source)) source = "Default"; } @@ -403,7 +403,7 @@ namespace System.Management.Automation mapArgs["ErrorId"] = icer.ErrorRecord.FullyQualifiedErrorId; if (icer.ErrorRecord.ErrorDetails != null - && !String.IsNullOrEmpty(icer.ErrorRecord.ErrorDetails.Message)) + && !string.IsNullOrEmpty(icer.ErrorRecord.ErrorDetails.Message)) { mapArgs["ErrorMessage"] = icer.ErrorRecord.ErrorDetails.Message; } @@ -631,7 +631,7 @@ namespace System.Management.Automation string messageTemplate = _resourceManager.GetString(messageId); - if (String.IsNullOrEmpty(messageTemplate)) + if (string.IsNullOrEmpty(messageTemplate)) return string.Empty; return FillMessageTemplate(messageTemplate, mapArgs); diff --git a/src/System.Management.Automation/namespaces/AliasProvider.cs b/src/System.Management.Automation/namespaces/AliasProvider.cs index f525a4727..7835193f5 100644 --- a/src/System.Management.Automation/namespaces/AliasProvider.cs +++ b/src/System.Management.Automation/namespaces/AliasProvider.cs @@ -124,7 +124,7 @@ namespace Microsoft.PowerShell.Commands internal override object GetSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); AliasInfo value = SessionState.Internal.GetAlias(name, Context.Origin); @@ -179,7 +179,7 @@ namespace Microsoft.PowerShell.Commands internal override void SetSessionStateItem(string name, object value, bool writeItem) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); AliasProviderDynamicParameters dynamicParameters = @@ -263,7 +263,7 @@ namespace Microsoft.PowerShell.Commands internal override void RemoveSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); SessionState.Internal.RemoveAlias(name, Force); diff --git a/src/System.Management.Automation/namespaces/EnvironmentProvider.cs b/src/System.Management.Automation/namespaces/EnvironmentProvider.cs index 88954238a..b19f21beb 100644 --- a/src/System.Management.Automation/namespaces/EnvironmentProvider.cs +++ b/src/System.Management.Automation/namespaces/EnvironmentProvider.cs @@ -77,7 +77,7 @@ namespace Microsoft.PowerShell.Commands internal override object GetSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); object result = null; @@ -107,7 +107,7 @@ namespace Microsoft.PowerShell.Commands internal override void SetSessionStateItem(string name, object value, bool writeItem) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); if (value == null) @@ -154,7 +154,7 @@ namespace Microsoft.PowerShell.Commands internal override void RemoveSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); Environment.SetEnvironmentVariable(name, null); diff --git a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs index 3ef1c744b..7a495d1d5 100644 --- a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs +++ b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs @@ -153,7 +153,7 @@ namespace Microsoft.PowerShell.Commands Encoding encoding, bool usingByteEncoding, bool waitForChanges, CmdletProvider provider, bool isRawStream) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentNullException("path"); } @@ -807,7 +807,7 @@ namespace Microsoft.PowerShell.Commands try { #if !UNIX - if (!String.IsNullOrEmpty(streamName)) + if (!string.IsNullOrEmpty(streamName)) { _stream = AlternateDataStreamUtilities.CreateFileStream(filePath, streamName, fileMode, fileAccess, fileShare); } @@ -820,7 +820,7 @@ namespace Microsoft.PowerShell.Commands catch (IOException) { #if !UNIX - if (!String.IsNullOrEmpty(streamName)) + if (!string.IsNullOrEmpty(streamName)) { _stream = AlternateDataStreamUtilities.CreateFileStream(filePath, streamName, fileMode, requestedAccess, fileShare); } diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 1135f89f4..a78314459 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -252,7 +252,7 @@ namespace Microsoft.PowerShell.Commands try { - if (!String.IsNullOrEmpty(helpItemName)) + if (!string.IsNullOrEmpty(helpItemName)) { CmdletInfo.SplitCmdletName(helpItemName, out verb, out noun); } @@ -261,7 +261,7 @@ namespace Microsoft.PowerShell.Commands return String.Empty; } - if (String.IsNullOrEmpty(verb) || String.IsNullOrEmpty(noun)) + if (string.IsNullOrEmpty(verb) || string.IsNullOrEmpty(noun)) { return String.Empty; } @@ -405,7 +405,7 @@ namespace Microsoft.PowerShell.Commands throw PSTraceSource.NewArgumentNullException("drive"); } - if (String.IsNullOrEmpty(drive.Root)) + if (string.IsNullOrEmpty(drive.Root)) { throw PSTraceSource.NewArgumentException("drive.Root"); } @@ -1031,7 +1031,7 @@ namespace Microsoft.PowerShell.Commands protected override bool IsValidPath(string path) { //Path passed should be fully qualified path. - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return false; } @@ -1102,7 +1102,7 @@ namespace Microsoft.PowerShell.Commands bool isContainer = false; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { // The parameter was null, throw an exception throw PSTraceSource.NewArgumentException("path"); @@ -1289,7 +1289,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void InvokeDefaultAction(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -1431,7 +1431,7 @@ namespace Microsoft.PowerShell.Commands { // Don't handle full paths, paths that the user is already trying to // filter, or paths they are trying to escape. - if ((!String.IsNullOrEmpty(filter)) || + if ((!string.IsNullOrEmpty(filter)) || (path.Contains(StringLiterals.DefaultPathSeparator, StringComparison.Ordinal)) || (path.Contains(StringLiterals.AlternatePathSeparator, StringComparison.Ordinal)) || (path.Contains(StringLiterals.EscapeCharacter))) @@ -1472,7 +1472,7 @@ namespace Microsoft.PowerShell.Commands ReturnContainers returnContainers) { // Verify parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -1819,7 +1819,7 @@ namespace Microsoft.PowerShell.Commands string switchParamString = sb.ToString(); - if (!String.IsNullOrEmpty(switchParamString)) + if (!string.IsNullOrEmpty(switchParamString)) { // Remove unnecessary PLUS sign switchParamEvaluator = new FlagsExpression(switchParamString.Substring(1)); @@ -1882,14 +1882,14 @@ namespace Microsoft.PowerShell.Commands { // Check the parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } path = NormalizePath(path); - if (String.IsNullOrEmpty(newName)) + if (string.IsNullOrEmpty(newName)) { throw PSTraceSource.NewArgumentException("newName"); @@ -2031,12 +2031,12 @@ namespace Microsoft.PowerShell.Commands // Verify parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } - if (String.IsNullOrEmpty(type)) + if (string.IsNullOrEmpty(type)) { type = "file"; } @@ -2125,7 +2125,7 @@ namespace Microsoft.PowerShell.Commands bool isDirectory = false; string strTargetPath = value.ToString(); - if (String.IsNullOrEmpty(strTargetPath)) + if (string.IsNullOrEmpty(strTargetPath)) { throw PSTraceSource.NewArgumentNullException("value"); } @@ -2507,7 +2507,7 @@ namespace Microsoft.PowerShell.Commands private void CreateDirectory(string path, bool streamOutput) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(path), + !string.IsNullOrEmpty(path), "The caller should verify path"); // Get the parent path @@ -2578,7 +2578,7 @@ namespace Microsoft.PowerShell.Commands { bool result = false; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -2603,7 +2603,7 @@ namespace Microsoft.PowerShell.Commands string parentPath = GetParentPath(path, root); - if (!String.IsNullOrEmpty(parentPath) && + if (!string.IsNullOrEmpty(parentPath) && String.Compare( parentPath, previousParent, @@ -2624,7 +2624,7 @@ namespace Microsoft.PowerShell.Commands } previousParent = parentPath; - } while (!String.IsNullOrEmpty(previousParent)); + } while (!string.IsNullOrEmpty(previousParent)); // Now create the missing directories @@ -2670,7 +2670,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void RemoveItem(string path, bool recurse) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -2881,7 +2881,7 @@ namespace Microsoft.PowerShell.Commands // Loop through each of the contained files and remove them. IEnumerable files = null; - if (!String.IsNullOrEmpty(Filter)) + if (!string.IsNullOrEmpty(Filter)) { files = directory.EnumerateFiles(Filter); } @@ -3138,7 +3138,7 @@ namespace Microsoft.PowerShell.Commands { error = null; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -3240,7 +3240,7 @@ namespace Microsoft.PowerShell.Commands // verify parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -3346,12 +3346,12 @@ namespace Microsoft.PowerShell.Commands string destinationPath, bool recurse) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } - if (String.IsNullOrEmpty(destinationPath)) + if (string.IsNullOrEmpty(destinationPath)) { throw PSTraceSource.NewArgumentException("destinationPath"); } @@ -3598,7 +3598,7 @@ namespace Microsoft.PowerShell.Commands IEnumerable files = null; - if (String.IsNullOrEmpty(Filter)) + if (string.IsNullOrEmpty(Filter)) { files = directory.EnumerateFiles(); } @@ -4537,7 +4537,7 @@ namespace Microsoft.PowerShell.Commands // Make the remote path var remoteFilePath = MakeRemotePath(ps, destinationPath, file.Name); - if (String.IsNullOrEmpty(remoteFilePath)) + if (string.IsNullOrEmpty(remoteFilePath)) { Exception e = new ArgumentException(String.Format(CultureInfo.InvariantCulture, SessionStateStrings.PathNotFound, destinationPath)); WriteError(new ErrorRecord(e, "RemotePathNotFound", ErrorCategory.WriteError, destinationPath)); @@ -4726,7 +4726,7 @@ namespace Microsoft.PowerShell.Commands { bool result = false; - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { if (IsUNCPath(path)) { @@ -4776,7 +4776,7 @@ namespace Microsoft.PowerShell.Commands /// private static bool IsPathRoot(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return false; } @@ -4809,7 +4809,7 @@ namespace Microsoft.PowerShell.Commands string path, string basePath) { - if (String.IsNullOrEmpty(path) || !IsValidPath(path)) + if (string.IsNullOrEmpty(path) || !IsValidPath(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -4835,7 +4835,7 @@ namespace Microsoft.PowerShell.Commands basePath = EnsureDriveIsRooted(basePath); result = path; - if (String.IsNullOrEmpty(result)) + if (string.IsNullOrEmpty(result)) { break; } @@ -4878,7 +4878,7 @@ namespace Microsoft.PowerShell.Commands string directoryPath = GetParentPath(result, String.Empty); - if (String.IsNullOrEmpty(directoryPath)) + if (string.IsNullOrEmpty(directoryPath)) { return String.Empty; } @@ -5063,7 +5063,7 @@ namespace Microsoft.PowerShell.Commands if (( !(path + StringLiterals.DefaultPathSeparator).StartsWith( basePath + StringLiterals.DefaultPathSeparator, StringComparison.OrdinalIgnoreCase)) && - (!String.IsNullOrEmpty(basePath)) + (!string.IsNullOrEmpty(basePath)) ) { result = String.Empty; @@ -5072,7 +5072,7 @@ namespace Microsoft.PowerShell.Commands Stack parentNavigationStack = TokenizePathToStack(basePath, commonBase); int parentPopCount = parentNavigationStack.Count; - if (String.IsNullOrEmpty(commonBase)) + if (string.IsNullOrEmpty(commonBase)) { parentPopCount--; } @@ -5091,7 +5091,7 @@ namespace Microsoft.PowerShell.Commands // ..\..\dir* // In that case (as above,) we keep the ..\..\directory1 // instead of ".." as would usually be returned - if (!String.IsNullOrEmpty(commonBase)) + if (!string.IsNullOrEmpty(commonBase)) { if (String.Equals(path, commonBase, StringComparison.OrdinalIgnoreCase) && (!path.EndsWith(StringLiterals.DefaultPathSeparator))) @@ -5118,7 +5118,7 @@ namespace Microsoft.PowerShell.Commands // on the value of basePath. if (IsPathRoot(path)) { - if (String.IsNullOrEmpty(basePath)) + if (string.IsNullOrEmpty(basePath)) { result = path; break; @@ -5153,7 +5153,7 @@ namespace Microsoft.PowerShell.Commands } while (false); #if !UNIX - if (!String.IsNullOrEmpty(alternateDataStream)) + if (!string.IsNullOrEmpty(alternateDataStream)) { result = result + alternateDataStream; } @@ -5241,7 +5241,7 @@ namespace Microsoft.PowerShell.Commands // if its valid string childName = GetChildName(tempPath); - if (String.IsNullOrEmpty(childName)) + if (string.IsNullOrEmpty(childName)) { // Push the parent on and then stop s_tracer.WriteLine("tokenizedPathStack.Push({0})", tempPath); @@ -5264,7 +5264,7 @@ namespace Microsoft.PowerShell.Commands if (tempPath.Length >= previousParent.Length || IsPathRoot(tempPath)) { - if (String.IsNullOrEmpty(basePath)) + if (string.IsNullOrEmpty(basePath)) { s_tracer.WriteLine("tokenizedPathStack.Push({0})", tempPath); tokenizedPathStack.Push(tempPath); @@ -5396,7 +5396,7 @@ namespace Microsoft.PowerShell.Commands while (normalizedPathStack.Count > 0) { - if (String.IsNullOrEmpty(leafElement)) + if (string.IsNullOrEmpty(leafElement)) { leafElement = normalizedPathStack.Pop(); } @@ -5426,7 +5426,7 @@ namespace Microsoft.PowerShell.Commands { // Verify the parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -5494,7 +5494,7 @@ namespace Microsoft.PowerShell.Commands /// protected override bool IsItemContainer(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -5528,12 +5528,12 @@ namespace Microsoft.PowerShell.Commands { // Check the parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } - if (String.IsNullOrEmpty(destination)) + if (string.IsNullOrEmpty(destination)) { throw PSTraceSource.NewArgumentException("destination"); } @@ -5636,7 +5636,7 @@ namespace Microsoft.PowerShell.Commands "The caller should verify file."); Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(destination), + !string.IsNullOrEmpty(destination), "THe caller should verify destination."); try @@ -5763,7 +5763,7 @@ namespace Microsoft.PowerShell.Commands "The caller should verify directory."); Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(destination), + !string.IsNullOrEmpty(destination), "The caller should verify destination."); try @@ -5901,7 +5901,7 @@ namespace Microsoft.PowerShell.Commands /// public void GetProperty(string path, Collection providerSpecificPickList) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -6034,7 +6034,7 @@ namespace Microsoft.PowerShell.Commands { // verify parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -6205,7 +6205,7 @@ namespace Microsoft.PowerShell.Commands string path, Collection propertiesToClear) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -6328,7 +6328,7 @@ namespace Microsoft.PowerShell.Commands /// public IContentReader GetContentReader(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -6502,7 +6502,7 @@ namespace Microsoft.PowerShell.Commands /// public IContentWriter GetContentWriter(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -6632,7 +6632,7 @@ namespace Microsoft.PowerShell.Commands /// public void ClearContent(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -6675,7 +6675,7 @@ namespace Microsoft.PowerShell.Commands streamName = writerDynamicParameters.Stream; } - if (String.IsNullOrEmpty(streamName)) + if (string.IsNullOrEmpty(streamName)) { // See if they've used the inline stream syntax. They have more than one colon. int firstColon = path.IndexOf(':'); @@ -7712,7 +7712,7 @@ namespace Microsoft.PowerShell.Commands var links = new List(); #if UNIX string link = Platform.NonWindowsInternalGetTarget(filePath); - if (!String.IsNullOrEmpty(link)) + if (!string.IsNullOrEmpty(link)) { links.Add(link); } @@ -8098,9 +8098,9 @@ namespace Microsoft.PowerShell.Commands [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods")] private static bool WinCreateJunction(string path, string target) { - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { - if (!String.IsNullOrEmpty(target)) + if (!string.IsNullOrEmpty(target)) { using (SafeHandle handle = OpenReparsePoint(path, FileDesiredAccess.GenericWrite)) { diff --git a/src/System.Management.Automation/namespaces/FileSystemSecurity.cs b/src/System.Management.Automation/namespaces/FileSystemSecurity.cs index 3157aa5bd..c3b1cc1f5 100644 --- a/src/System.Management.Automation/namespaces/FileSystemSecurity.cs +++ b/src/System.Management.Automation/namespaces/FileSystemSecurity.cs @@ -44,7 +44,7 @@ namespace Microsoft.PowerShell.Commands ObjectSecurity sd = null; path = NormalizePath(path); - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentNullException("path"); } @@ -101,7 +101,7 @@ namespace Microsoft.PowerShell.Commands string path, ObjectSecurity securityDescriptor) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } diff --git a/src/System.Management.Automation/namespaces/FunctionProvider.cs b/src/System.Management.Automation/namespaces/FunctionProvider.cs index 390b51c32..3ad565e14 100644 --- a/src/System.Management.Automation/namespaces/FunctionProvider.cs +++ b/src/System.Management.Automation/namespaces/FunctionProvider.cs @@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands internal override object GetSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); CommandInfo function = SessionState.Internal.GetFunction(name, Context.Origin); @@ -149,7 +149,7 @@ namespace Microsoft.PowerShell.Commands internal override void SetSessionStateItem(string name, object value, bool writeItem) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); FunctionProviderDynamicParameters dynamicParameters = @@ -262,7 +262,7 @@ namespace Microsoft.PowerShell.Commands internal override void RemoveSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); SessionState.Internal.RemoveFunction(name, Force); diff --git a/src/System.Management.Automation/namespaces/LocationGlobber.cs b/src/System.Management.Automation/namespaces/LocationGlobber.cs index becfd852c..e8a6b07bf 100644 --- a/src/System.Management.Automation/namespaces/LocationGlobber.cs +++ b/src/System.Management.Automation/namespaces/LocationGlobber.cs @@ -1970,10 +1970,10 @@ namespace System.Management.Automation // Keep on lopping off children until the the remaining path // is the drive root. - while ((!String.IsNullOrEmpty(providerPath)) && + while ((!string.IsNullOrEmpty(providerPath)) && (!providerPath.Equals(driveRoot, StringComparison.OrdinalIgnoreCase))) { - if (!String.IsNullOrEmpty(childPath)) + if (!string.IsNullOrEmpty(childPath)) { childPath = _sessionState.Internal.MakePath( providerInstance, @@ -2060,7 +2060,7 @@ namespace System.Management.Automation // the supplied path string driveRootRelativeWorkingPath = drive.CurrentLocation; - if ((!String.IsNullOrEmpty(driveRootRelativeWorkingPath) && + if ((!string.IsNullOrEmpty(driveRootRelativeWorkingPath) && (driveRootRelativeWorkingPath.StartsWith(drive.Root, StringComparison.Ordinal)))) { driveRootRelativeWorkingPath = driveRootRelativeWorkingPath.Substring(drive.Root.Length); @@ -2085,7 +2085,7 @@ namespace System.Management.Automation // We don't want to process other relative path // symbols in this case - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { // Just fall-through } @@ -2135,7 +2135,7 @@ namespace System.Management.Automation (pathLengthEqualsParentDirSymbol || pathDirSymbolFollowedBySeparator)) { - if (!String.IsNullOrEmpty(driveRootRelativeWorkingPath)) + if (!string.IsNullOrEmpty(driveRootRelativeWorkingPath)) { // Use the provider to get the current path @@ -2239,7 +2239,7 @@ namespace System.Management.Automation // If more relative path remains add that to // the known absolute path - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { driveRootRelativeWorkingPath = _sessionState.Internal.MakePath( @@ -2255,7 +2255,7 @@ namespace System.Management.Automation string rootedPath = _sessionState.Internal.MakePath(context.Drive.Root, driveRootRelativeWorkingPath, context); string normalizedRelativePath = navigationProvider.ContractRelativePath(rootedPath, context.Drive.Root, false, context); - if (!String.IsNullOrEmpty(normalizedRelativePath)) + if (!string.IsNullOrEmpty(normalizedRelativePath)) { if (normalizedRelativePath.StartsWith(context.Drive.Root, StringComparison.Ordinal)) driveRootRelativeWorkingPath = normalizedRelativePath.Substring(context.Drive.Root.Length); @@ -2693,7 +2693,7 @@ namespace System.Management.Automation leafElement = navigationProvider.GetChildName(path, context); } - if (String.IsNullOrEmpty(leafElement)) + if (string.IsNullOrEmpty(leafElement)) { break; } @@ -2763,7 +2763,7 @@ namespace System.Management.Automation { leafElement = navigationProvider.GetChildName(path, context); - if (!String.IsNullOrEmpty(leafElement)) + if (!string.IsNullOrEmpty(leafElement)) { path = navigationProvider.GetParentPath(path, null, context); } @@ -3652,7 +3652,7 @@ namespace System.Management.Automation leafElement = navigationProvider.GetChildName(path, context); } - if (String.IsNullOrEmpty(leafElement)) + if (string.IsNullOrEmpty(leafElement)) { break; } @@ -3735,7 +3735,7 @@ namespace System.Management.Automation { leafElement = navigationProvider.GetChildName(path, context); - if (!String.IsNullOrEmpty(leafElement)) + if (!string.IsNullOrEmpty(leafElement)) { path = navigationProvider.GetParentPath(path, null, context); } @@ -4664,7 +4664,7 @@ namespace System.Management.Automation s_pathResolutionTracer.WriteLine("Getting home path for provider: {0}", provider.Name); s_pathResolutionTracer.WriteLine("Provider HOME path: {0}", provider.Home); - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { path = provider.Home; } diff --git a/src/System.Management.Automation/namespaces/NavigationProviderBase.cs b/src/System.Management.Automation/namespaces/NavigationProviderBase.cs index 0b3dac347..306ffba67 100644 --- a/src/System.Management.Automation/namespaces/NavigationProviderBase.cs +++ b/src/System.Management.Automation/namespaces/NavigationProviderBase.cs @@ -322,23 +322,23 @@ namespace System.Management.Automation.Provider throw PSTraceSource.NewArgumentException("parent"); } - else if (String.IsNullOrEmpty(parent) && - String.IsNullOrEmpty(child)) + else if (string.IsNullOrEmpty(parent) && + string.IsNullOrEmpty(child)) { // If both are empty, just return the empty string. result = String.Empty; } - else if (String.IsNullOrEmpty(parent) && - !String.IsNullOrEmpty(child)) + else if (string.IsNullOrEmpty(parent) && + !string.IsNullOrEmpty(child)) { // If the parent is empty but the child is not, return the // child result = child.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator); } - else if (!String.IsNullOrEmpty(parent) && - String.IsNullOrEmpty(child)) + else if (!string.IsNullOrEmpty(parent) && + string.IsNullOrEmpty(child)) { // If the child is empty but the parent is not, return the // parent with the path separator appended. @@ -449,7 +449,7 @@ namespace System.Management.Automation.Provider // Verify the parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -629,7 +629,7 @@ namespace System.Management.Automation.Provider Stack parentNavigationStack = TokenizePathToStack(normalizedBasePath, commonBase); int parentPopCount = parentNavigationStack.Count; - if (String.IsNullOrEmpty(commonBase)) + if (string.IsNullOrEmpty(commonBase)) { parentPopCount--; } @@ -648,7 +648,7 @@ namespace System.Management.Automation.Provider // ..\..\dir* // In that case (as above,) we keep the ..\..\directory1 // instead of ".." as would usually be returned - if (!String.IsNullOrEmpty(commonBase)) + if (!string.IsNullOrEmpty(commonBase)) { if (String.Equals(normalizedPath, commonBase, StringComparison.OrdinalIgnoreCase) && (!normalizedPath.EndsWith(StringLiterals.DefaultPathSeparator))) @@ -748,7 +748,7 @@ namespace System.Management.Automation.Provider { // Verify the parameters - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -772,7 +772,7 @@ namespace System.Management.Automation.Provider string parentPath = GetParentPath(path, null); // No parent, return the entire path - if (String.IsNullOrEmpty(parentPath)) + if (string.IsNullOrEmpty(parentPath)) result = path; // If the parent path ends with the path separator, we can't split // the path based on that @@ -952,7 +952,7 @@ namespace System.Management.Automation.Provider { result = true; } - else if (this.PSDriveInfo != null && !String.IsNullOrEmpty(this.PSDriveInfo.Root) && + else if (this.PSDriveInfo != null && !string.IsNullOrEmpty(this.PSDriveInfo.Root) && path.StartsWith(this.PSDriveInfo.Root, StringComparison.OrdinalIgnoreCase)) { result = true; @@ -986,7 +986,7 @@ namespace System.Management.Automation.Provider // if its valid string childName = GetChildName(tempPath); - if (String.IsNullOrEmpty(childName)) + if (string.IsNullOrEmpty(childName)) { // Push the parent on and then stop tokenizedPathStack.Push(tempPath); @@ -1104,7 +1104,7 @@ namespace System.Management.Automation.Provider while (normalizedPathStack.Count > 0) { - if (String.IsNullOrEmpty(leafElement)) + if (string.IsNullOrEmpty(leafElement)) { leafElement = normalizedPathStack.Pop(); } diff --git a/src/System.Management.Automation/namespaces/ProviderBase.cs b/src/System.Management.Automation/namespaces/ProviderBase.cs index 8838e4b01..c15a6bb09 100644 --- a/src/System.Management.Automation/namespaces/ProviderBase.cs +++ b/src/System.Management.Automation/namespaces/ProviderBase.cs @@ -112,7 +112,7 @@ namespace System.Management.Automation.Provider /// internal virtual bool IsFilterSet() { - bool filterSet = !String.IsNullOrEmpty(Filter); + bool filterSet = !string.IsNullOrEmpty(Filter); return filterSet; } @@ -160,7 +160,7 @@ namespace System.Management.Automation.Provider } // Check that the provider supports the use of filters - if ((!String.IsNullOrEmpty(value.Filter)) && + if ((!string.IsNullOrEmpty(value.Filter)) && (!CmdletProviderManagementIntrinsics.CheckProviderCapabilities(ProviderCapabilities.Filter, _providerInformation))) { throw PSTraceSource.NewNotSupportedException( @@ -1407,12 +1407,12 @@ namespace System.Management.Automation.Provider { using (PSTransactionManager.GetEngineProtectionScope()) { - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) { throw PSTraceSource.NewArgumentException("baseName"); } - if (String.IsNullOrEmpty(resourceId)) + if (string.IsNullOrEmpty(resourceId)) { throw PSTraceSource.NewArgumentException("resourceId"); } @@ -1831,7 +1831,7 @@ namespace System.Management.Automation.Provider string providerQualifiedParentPath = String.Empty; - if (!String.IsNullOrEmpty(parentPath)) + if (!string.IsNullOrEmpty(parentPath)) { providerQualifiedParentPath = LocationGlobber.GetProviderQualifiedPath(parentPath, ProviderInfo); diff --git a/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs b/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs index ce5fe98d8..a302516ea 100644 --- a/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs +++ b/src/System.Management.Automation/namespaces/ProviderDeclarationAttribute.cs @@ -35,7 +35,7 @@ namespace System.Management.Automation.Provider { // verify parameters - if (String.IsNullOrEmpty(providerName)) + if (string.IsNullOrEmpty(providerName)) { throw PSTraceSource.NewArgumentNullException("providerName"); } diff --git a/src/System.Management.Automation/namespaces/RegistryProvider.cs b/src/System.Management.Automation/namespaces/RegistryProvider.cs index 82c5231df..6fe215ae9 100644 --- a/src/System.Management.Automation/namespaces/RegistryProvider.cs +++ b/src/System.Management.Automation/namespaces/RegistryProvider.cs @@ -185,7 +185,7 @@ namespace Microsoft.PowerShell.Commands root = root.Substring(0, pathSeparator); } - if (String.IsNullOrEmpty(root)) + if (string.IsNullOrEmpty(root)) { // An empty path means that we are at the root and should // enumerate the hives. So that is a valid path. @@ -238,7 +238,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void SetItem(string path, object value) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -402,7 +402,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ClearItem(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -570,7 +570,7 @@ namespace Microsoft.PowerShell.Commands return; } - if (!String.IsNullOrEmpty(subkeyName)) + if (!string.IsNullOrEmpty(subkeyName)) { string keypath = path; @@ -580,7 +580,7 @@ namespace Microsoft.PowerShell.Commands keypath = MakePath(path, subkeyName, childIsLeaf: true); - if (!String.IsNullOrEmpty(keypath)) + if (!string.IsNullOrEmpty(keypath)) { // Call GetItem to retrieve the RegistryKey object // and write it to the WriteObject method. @@ -860,12 +860,12 @@ namespace Microsoft.PowerShell.Commands string path, string newName) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } - if (String.IsNullOrEmpty(newName)) + if (string.IsNullOrEmpty(newName)) { throw PSTraceSource.NewArgumentException("newName"); } @@ -930,7 +930,7 @@ namespace Microsoft.PowerShell.Commands string type, object newItem) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -1089,7 +1089,7 @@ namespace Microsoft.PowerShell.Commands string path, bool recurse) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -1287,12 +1287,12 @@ namespace Microsoft.PowerShell.Commands string destination, bool recurse) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } - if (String.IsNullOrEmpty(destination)) + if (string.IsNullOrEmpty(destination)) { throw PSTraceSource.NewArgumentException("destination"); } @@ -1362,11 +1362,11 @@ namespace Microsoft.PowerShell.Commands "The key should have been validated by the caller"); Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(path), + !string.IsNullOrEmpty(path), "The path should have been validated by the caller"); Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(destination), + !string.IsNullOrEmpty(destination), "The destination should have been validated by the caller"); s_tracer.WriteLine("destination = {0}", destination); @@ -1523,7 +1523,7 @@ namespace Microsoft.PowerShell.Commands string newDestinationPath = GetParentPath(destinationPath, null); - if (String.IsNullOrEmpty(newDestinationPath)) + if (string.IsNullOrEmpty(newDestinationPath)) { // We reached the root so the destination must not be a child // of the source @@ -1631,12 +1631,12 @@ namespace Microsoft.PowerShell.Commands string path, string destination) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } - if (String.IsNullOrEmpty(destination)) + if (string.IsNullOrEmpty(destination)) { throw PSTraceSource.NewArgumentException("destination"); } @@ -1803,7 +1803,7 @@ namespace Microsoft.PowerShell.Commands foreach (string valueName in filteredPropertyCollection) { string notePropertyName = valueName; - if (String.IsNullOrEmpty(valueName)) + if (string.IsNullOrEmpty(valueName)) { // If the value name is empty then using "(default)" // as the property name when adding the note, as @@ -2012,7 +2012,7 @@ namespace Microsoft.PowerShell.Commands // reset the value of the property to its default value object defaultValue = ResetRegistryKeyValue(key, valueName); string propertyNameToAdd = valueName; - if (String.IsNullOrEmpty(valueName)) + if (string.IsNullOrEmpty(valueName)) { propertyNameToAdd = GetLocalizedDefaultToken(); } @@ -2624,7 +2624,7 @@ namespace Microsoft.PowerShell.Commands if (!originalPathExists) originalPathExistsWithRoot = ItemExists(MakePath(root, path)); - if ((!String.IsNullOrEmpty(parentPath)) && (originalPathExists || originalPathExistsWithRoot)) + if ((!string.IsNullOrEmpty(parentPath)) && (originalPathExists || originalPathExistsWithRoot)) { string parentPathToTest = parentPath; @@ -2638,7 +2638,7 @@ namespace Microsoft.PowerShell.Commands break; parentPath = base.GetParentPath(parentPath, root); - } while (!String.IsNullOrEmpty(parentPath)); + } while (!string.IsNullOrEmpty(parentPath)); } } @@ -2932,7 +2932,7 @@ namespace Microsoft.PowerShell.Commands { string result = path; - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { result = path.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator); @@ -2968,7 +2968,7 @@ namespace Microsoft.PowerShell.Commands { bool expandAll = false; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -3039,12 +3039,12 @@ namespace Microsoft.PowerShell.Commands string valueNameToMatch = valueName; // Need to convert the default value name to "(default)" - if (String.IsNullOrEmpty(valueName)) + if (string.IsNullOrEmpty(valueName)) { // Only do the conversion if the caller isn't asking for // "" or null. - if (!String.IsNullOrEmpty(requestedValueName)) + if (!string.IsNullOrEmpty(requestedValueName)) { valueNameToMatch = GetLocalizedDefaultToken(); } @@ -3055,7 +3055,7 @@ namespace Microsoft.PowerShell.Commands ((Context.SuppressWildcardExpansion == false) && (valueNameMatcher.IsMatch(valueNameToMatch))) || ((Context.SuppressWildcardExpansion == true) && (String.Equals(valueNameToMatch, requestedValueName, StringComparison.OrdinalIgnoreCase)))) { - if (String.IsNullOrEmpty(valueNameToMatch)) + if (string.IsNullOrEmpty(valueNameToMatch)) { // If the value name is empty then using "(default)" // as the property name when adding the note, as @@ -3193,7 +3193,7 @@ namespace Microsoft.PowerShell.Commands throw PSTraceSource.NewArgumentNullException("path"); } - if (String.IsNullOrEmpty(path) || + if (string.IsNullOrEmpty(path) || (String.Compare(path, "\\", StringComparison.OrdinalIgnoreCase) == 0) || (String.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0)) { @@ -3262,7 +3262,7 @@ namespace Microsoft.PowerShell.Commands /// private IRegistryWrapper GetHiveRoot(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -3310,7 +3310,7 @@ namespace Microsoft.PowerShell.Commands bool result = false; // Check input. - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } @@ -3491,7 +3491,7 @@ namespace Microsoft.PowerShell.Commands /// private IRegistryWrapper GetRegkeyForPath(string path, bool writeAccess) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { // The key was not found, write out an error. @@ -3556,7 +3556,7 @@ namespace Microsoft.PowerShell.Commands IRegistryWrapper tempKey = null; // While there is still more to process - while (!String.IsNullOrEmpty(remainingPath)) + while (!string.IsNullOrEmpty(remainingPath)) { bool foundSubkey = false; @@ -3771,7 +3771,7 @@ namespace Microsoft.PowerShell.Commands PSObject result = new PSObject(); string propertyNameToAdd = propertyName; - if (String.IsNullOrEmpty(propertyName)) + if (string.IsNullOrEmpty(propertyName)) { propertyNameToAdd = GetLocalizedDefaultToken(); } @@ -4016,7 +4016,7 @@ namespace Microsoft.PowerShell.Commands for (int index = 0; index < valueNames.Length; ++index) { - if (String.IsNullOrEmpty(valueNames[index])) + if (string.IsNullOrEmpty(valueNames[index])) { // The first unnamed value becomes the default value valueNames[index] = GetLocalizedDefaultToken(); @@ -4045,7 +4045,7 @@ namespace Microsoft.PowerShell.Commands { kind = RegistryValueKind.Unknown; - if (String.IsNullOrEmpty(type)) + if (string.IsNullOrEmpty(type)) { return true; } @@ -4120,7 +4120,7 @@ namespace Microsoft.PowerShell.Commands { string result = userEnteredPropertyName; - if (!String.IsNullOrEmpty(userEnteredPropertyName)) + if (!string.IsNullOrEmpty(userEnteredPropertyName)) { var stringComparer = Host.CurrentCulture.CompareInfo; diff --git a/src/System.Management.Automation/namespaces/RegistrySecurity.cs b/src/System.Management.Automation/namespaces/RegistrySecurity.cs index 1dd8f6be5..afb9eaa12 100644 --- a/src/System.Management.Automation/namespaces/RegistrySecurity.cs +++ b/src/System.Management.Automation/namespaces/RegistrySecurity.cs @@ -46,7 +46,7 @@ namespace Microsoft.PowerShell.Commands IRegistryWrapper key = null; // Validate input first. - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentNullException("path"); } @@ -91,7 +91,7 @@ namespace Microsoft.PowerShell.Commands { IRegistryWrapper key = null; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } diff --git a/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs b/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs index 680b3d2ef..b5e17dd25 100644 --- a/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs +++ b/src/System.Management.Automation/namespaces/SessionStateProviderBase.cs @@ -150,7 +150,7 @@ namespace Microsoft.PowerShell.Commands IDictionary table = GetSessionStateTable(); if (table != null) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { isContainer = true; item = table.Values; @@ -187,7 +187,7 @@ namespace Microsoft.PowerShell.Commands string name, object value) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { WriteError(new ErrorRecord( PSTraceSource.NewArgumentNullException("name"), @@ -238,7 +238,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ClearItem(string path) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { WriteError(new ErrorRecord( PSTraceSource.NewArgumentNullException("path"), @@ -299,7 +299,7 @@ namespace Microsoft.PowerShell.Commands protected override void GetChildItems(string path, bool recurse) { CommandOrigin origin = this.Context.Origin; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { IDictionary dictionary = null; @@ -415,7 +415,7 @@ namespace Microsoft.PowerShell.Commands protected override void GetChildNames(string path, ReturnContainers returnContainers) { CommandOrigin origin = this.Context.Origin; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { IDictionary dictionary = null; @@ -508,7 +508,7 @@ namespace Microsoft.PowerShell.Commands { bool result = false; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { try { @@ -545,7 +545,7 @@ namespace Microsoft.PowerShell.Commands { bool result = false; - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { result = true; } @@ -591,7 +591,7 @@ namespace Microsoft.PowerShell.Commands /// protected override bool IsValidPath(string path) { - return !String.IsNullOrEmpty(path); + return !string.IsNullOrEmpty(path); } /// @@ -605,7 +605,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void RemoveItem(string path, bool recurse) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { Exception e = PSTraceSource.NewArgumentException("path"); @@ -679,7 +679,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void NewItem(string path, string type, object newItem) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { Exception e = PSTraceSource.NewArgumentException("path"); @@ -757,7 +757,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void CopyItem(string path, string copyPath, bool recurse) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { Exception e = PSTraceSource.NewArgumentException("path"); @@ -772,7 +772,7 @@ namespace Microsoft.PowerShell.Commands // If copyPath is null or empty, that means we are trying to copy // the item to itself so it should be a no-op. - if (String.IsNullOrEmpty(copyPath)) + if (string.IsNullOrEmpty(copyPath)) { // Just get the item for -passthru GetItem(path); @@ -863,7 +863,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void RenameItem(string name, string newName) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { Exception e = PSTraceSource.NewArgumentException("name"); @@ -1102,7 +1102,7 @@ namespace Microsoft.PowerShell.Commands /// internal SessionStateProviderBaseContentReaderWriter(string path, SessionStateProviderBase provider) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { throw PSTraceSource.NewArgumentException("path"); } diff --git a/src/System.Management.Automation/namespaces/StackInfo.cs b/src/System.Management.Automation/namespaces/StackInfo.cs index 601fc2061..497a85fbe 100644 --- a/src/System.Management.Automation/namespaces/StackInfo.cs +++ b/src/System.Management.Automation/namespaces/StackInfo.cs @@ -32,7 +32,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("locationStack"); } - if (String.IsNullOrEmpty(stackName)) + if (string.IsNullOrEmpty(stackName)) { throw PSTraceSource.NewArgumentException("stackName"); } diff --git a/src/System.Management.Automation/namespaces/VariableProvider.cs b/src/System.Management.Automation/namespaces/VariableProvider.cs index d2df4f0dc..10e20417a 100644 --- a/src/System.Management.Automation/namespaces/VariableProvider.cs +++ b/src/System.Management.Automation/namespaces/VariableProvider.cs @@ -81,7 +81,7 @@ namespace Microsoft.PowerShell.Commands internal override object GetSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); return (PSVariable)SessionState.Internal.GetVariable(name, Context.Origin); @@ -102,7 +102,7 @@ namespace Microsoft.PowerShell.Commands internal override void SetSessionStateItem(string name, object value, bool writeItem) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); PSVariable variable = null; @@ -148,7 +148,7 @@ namespace Microsoft.PowerShell.Commands internal override void RemoveSessionStateItem(string name) { Dbg.Diagnostics.Assert( - !String.IsNullOrEmpty(name), + !string.IsNullOrEmpty(name), "The caller should verify this parameter"); SessionState.Internal.RemoveVariable(name, Force); diff --git a/src/System.Management.Automation/security/Authenticode.cs b/src/System.Management.Automation/security/Authenticode.cs index 55e3f2407..a3efa276e 100644 --- a/src/System.Management.Automation/security/Authenticode.cs +++ b/src/System.Management.Automation/security/Authenticode.cs @@ -106,7 +106,7 @@ namespace System.Management.Automation Utils.CheckArgForNull(certificate, "certificate"); // If given, TimeStamp server URLs must begin with http:// - if (!String.IsNullOrEmpty(timeStampServerUrl)) + if (!string.IsNullOrEmpty(timeStampServerUrl)) { if ((timeStampServerUrl.Length <= 7) || (timeStampServerUrl.IndexOf("http://", StringComparison.OrdinalIgnoreCase) != 0)) @@ -118,7 +118,7 @@ namespace System.Management.Automation } // Validate that the hash algorithm is valid - if (!String.IsNullOrEmpty(hashAlgorithm)) + if (!string.IsNullOrEmpty(hashAlgorithm)) { IntPtr intptrAlgorithm = Marshal.StringToHGlobalUni(hashAlgorithm); @@ -160,7 +160,7 @@ namespace System.Management.Automation // It expects null, only. Instead, it randomly AVs if you // try. string timeStampServerUrlForCryptUI = null; - if (!String.IsNullOrEmpty(timeStampServerUrl)) + if (!string.IsNullOrEmpty(timeStampServerUrl)) { timeStampServerUrlForCryptUI = timeStampServerUrl; } diff --git a/src/System.Management.Automation/security/CatalogHelper.cs b/src/System.Management.Automation/security/CatalogHelper.cs index f343423e2..cb9b79095 100644 --- a/src/System.Management.Automation/security/CatalogHelper.cs +++ b/src/System.Management.Automation/security/CatalogHelper.cs @@ -287,7 +287,7 @@ namespace System.Management.Automation memberFile = NativeMethods.CryptCATCDFEnumMembersByCDFTagEx(resultCDF, memberFile, memberCallBack, ref memberInfo, true, IntPtr.Zero); fileName = Marshal.PtrToStringUni(memberFile); - if (!String.IsNullOrEmpty(fileName)) + if (!string.IsNullOrEmpty(fileName)) { IntPtr memberAttr = IntPtr.Zero; string fileRelativePath = String.Empty; @@ -298,7 +298,7 @@ namespace System.Management.Automation if (memberAttr != IntPtr.Zero) { fileRelativePath = ProcessFilePathAttributeInCatalog(memberAttr); - if (!String.IsNullOrEmpty(fileRelativePath)) + if (!string.IsNullOrEmpty(fileRelativePath)) { // Found the attribute we are looking for // Filename we read from the above API has appended to its name as per CDF file tags convention @@ -338,7 +338,7 @@ namespace System.Management.Automation _cmdlet = cmdlet; string hashAlgorithm = GetCatalogHashAlgorithm(catalogVersion); - if (!String.IsNullOrEmpty(hashAlgorithm)) + if (!string.IsNullOrEmpty(hashAlgorithm)) { // Generate Path for Catalog Definition File string cdfFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); @@ -503,7 +503,7 @@ namespace System.Management.Automation if (catAttrInfo != IntPtr.Zero) { string relativePath = ProcessFilePathAttributeInCatalog(catAttrInfo); - if (!String.IsNullOrEmpty(relativePath)) + if (!string.IsNullOrEmpty(relativePath)) { ProcessCatalogFile(relativePath, string.Empty, excludedPatterns, ref catalogHashes); } @@ -535,7 +535,7 @@ namespace System.Management.Automation if (memberAttrInfo != IntPtr.Zero) { relativePath = ProcessFilePathAttributeInCatalog(memberAttrInfo); - if (!String.IsNullOrEmpty(relativePath)) + if (!string.IsNullOrEmpty(relativePath)) { break; } @@ -546,7 +546,7 @@ namespace System.Management.Automation // If we did not find any Relative Path for the item in catalog we should quit // This catalog must not be valid for our use as catalogs generated using New-FileCatalog // always contains relative file Paths - if (String.IsNullOrEmpty(relativePath)) + if (string.IsNullOrEmpty(relativePath)) { ErrorRecord errorRecord = new ErrorRecord(new InvalidOperationException(StringUtil.Format(CatalogStrings.UnableToOpenCatalogFile, catalogFilePath)), "UnableToOpenCatalogFile", ErrorCategory.InvalidOperation, null); _cmdlet.ThrowTerminatingError(errorRecord); @@ -743,7 +743,7 @@ namespace System.Management.Automation Dictionary catalogHashes = GetHashesFromCatalog(catalogFilePath, excludedPatterns, out catalogVersion); string hashAlgorithm = GetCatalogHashAlgorithm(catalogVersion); - if (!String.IsNullOrEmpty(hashAlgorithm)) + if (!string.IsNullOrEmpty(hashAlgorithm)) { Dictionary fileHashes = CalculateHashesFromPath(catalogFolders, catalogFilePath, hashAlgorithm, excludedPatterns); CatalogInformation catalog = new CatalogInformation(); diff --git a/src/System.Management.Automation/security/MshSignature.cs b/src/System.Management.Automation/security/MshSignature.cs index 324394e7f..78cf8120c 100644 --- a/src/System.Management.Automation/security/MshSignature.cs +++ b/src/System.Management.Automation/security/MshSignature.cs @@ -366,7 +366,7 @@ namespace System.Management.Automation resourceString = MshSignature.MshSignature_NotSupportedFileFormat; arg = System.IO.Path.GetExtension(filePath); - if (String.IsNullOrEmpty(arg)) + if (string.IsNullOrEmpty(arg)) { resourceString = MshSignature.MshSignature_NotSupportedFileFormat_NoExtension; arg = null; diff --git a/src/System.Management.Automation/security/SecurityManager.cs b/src/System.Management.Automation/security/SecurityManager.cs index baeac7fea..9965ca12d 100644 --- a/src/System.Management.Automation/security/SecurityManager.cs +++ b/src/System.Management.Automation/security/SecurityManager.cs @@ -194,7 +194,7 @@ namespace Microsoft.PowerShell if (!IsLocalFile(fi.FullName)) { // Get the signature of the file. - if (String.IsNullOrEmpty(script.ScriptContents)) + if (string.IsNullOrEmpty(script.ScriptContents)) { reasonMessage = StringUtil.Format(Authenticode.Reason_FileContentUnavailable, path); reason = new UnauthorizedAccessException(reasonMessage); @@ -265,7 +265,7 @@ namespace Microsoft.PowerShell // make it so. // Get the signature of the file. - if (String.IsNullOrEmpty(script.ScriptContents)) + if (string.IsNullOrEmpty(script.ScriptContents)) { reasonMessage = StringUtil.Format(Authenticode.Reason_FileContentUnavailable, path); reason = new UnauthorizedAccessException(reasonMessage); diff --git a/src/System.Management.Automation/security/SecuritySupport.cs b/src/System.Management.Automation/security/SecuritySupport.cs index 5b67696ba..93fc4dee6 100644 --- a/src/System.Management.Automation/security/SecuritySupport.cs +++ b/src/System.Management.Automation/security/SecuritySupport.cs @@ -285,7 +285,7 @@ namespace System.Management.Automation.Internal { string policy = Environment.GetEnvironmentVariable("PSExecutionPolicyPreference"); - if (!String.IsNullOrEmpty(policy)) + if (!string.IsNullOrEmpty(policy)) return ParseExecutionPolicy(policy); else return ExecutionPolicy.Undefined; @@ -296,7 +296,7 @@ namespace System.Management.Automation.Internal { string policy = GetLocalPreferenceValue(shellId, scope); - if (!String.IsNullOrEmpty(policy)) + if (!string.IsNullOrEmpty(policy)) return ParseExecutionPolicy(policy); else return ExecutionPolicy.Undefined; @@ -312,7 +312,7 @@ namespace System.Management.Automation.Internal // Be sure we aren't being called by Group Policy // itself. A group policy should never block a logon / // logoff script. - if (String.IsNullOrEmpty(groupPolicyPreference) || HasGpScriptParent) + if (string.IsNullOrEmpty(groupPolicyPreference) || HasGpScriptParent) { return ExecutionPolicy.Undefined; } @@ -378,7 +378,7 @@ namespace System.Management.Automation.Internal /// True when file has product binary signature. public static bool IsProductBinary(string file) { - if (String.IsNullOrEmpty(file) || (!IO.File.Exists(file))) + if (string.IsNullOrEmpty(file) || (!IO.File.Exists(file))) { return false; } @@ -1552,7 +1552,7 @@ namespace System.Management.Automation internal static AmsiNativeMethods.AMSI_RESULT WinScanContent(string content, string sourceMetadata, bool warmUp) { - if (String.IsNullOrEmpty(sourceMetadata)) + if (string.IsNullOrEmpty(sourceMetadata)) { sourceMetadata = String.Empty; } diff --git a/src/System.Management.Automation/security/wldpNativeMethods.cs b/src/System.Management.Automation/security/wldpNativeMethods.cs index ebd33d5b7..477c87b33 100644 --- a/src/System.Management.Automation/security/wldpNativeMethods.cs +++ b/src/System.Management.Automation/security/wldpNativeMethods.cs @@ -120,7 +120,7 @@ namespace System.Management.Automation.Security } // If path is NULL, see if we have the cached system-wide lockdown policy. - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { if ((s_cachedWldpSystemPolicy != null) && (!InternalTestHooks.BypassAppLockerPolicyCaching)) { @@ -134,7 +134,7 @@ namespace System.Management.Automation.Security hostInformation.dwRevision = WldpNativeConstants.WLDP_HOST_INFORMATION_REVISION; hostInformation.dwHostId = WLDP_HOST_ID.WLDP_HOST_ID_POWERSHELL; - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { hostInformation.szSource = path; @@ -153,7 +153,7 @@ namespace System.Management.Automation.Security SystemEnforcementMode resultingLockdownPolicy = GetLockdownPolicyForResult(pdwLockdownState); // If this is a query for the system-wide lockdown policy, cache it. - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { s_cachedWldpSystemPolicy = resultingLockdownPolicy; } @@ -185,7 +185,7 @@ namespace System.Management.Automation.Security // Since there is no way to get that from AppLocker, we will test the policy // against a random non-existent script and module. If that is allowed, then there is // no AppLocker script policy. - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { if ((s_cachedSaferSystemPolicy != null) && (!InternalTestHooks.BypassAppLockerPolicyCaching)) { diff --git a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs index c5ec6db90..104dddc4d 100644 --- a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs +++ b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs @@ -229,7 +229,7 @@ namespace System.Management.Automation { get { - if (String.IsNullOrEmpty(ModuleName) || Path.IsPathRooted(ModuleName)) + if (string.IsNullOrEmpty(ModuleName) || Path.IsPathRooted(ModuleName)) { return ModuleName; } @@ -385,12 +385,12 @@ namespace System.Management.Automation } } - if (String.IsNullOrEmpty(_description)) + if (string.IsNullOrEmpty(_description)) { _description = _descriptionFallback; } - if (String.IsNullOrEmpty(_vendor)) + if (string.IsNullOrEmpty(_vendor)) { _vendor = _vendorFallback; } @@ -425,7 +425,7 @@ namespace System.Management.Automation /// PSSnapIn Id to validate. internal static bool IsPSSnapinIdValid(string psSnapinId) { - if (String.IsNullOrEmpty(psSnapinId)) + if (string.IsNullOrEmpty(psSnapinId)) { return false; } @@ -723,7 +723,7 @@ namespace System.Management.Automation bool logPipelineExecutionDetails = false; string logPipelineExecutionDetailsStr = ReadStringValue(mshsnapinKey, RegistryStrings.MshSnapin_LogPipelineExecutionDetails, false); - if (!String.IsNullOrEmpty(logPipelineExecutionDetailsStr)) + if (!string.IsNullOrEmpty(logPipelineExecutionDetailsStr)) { 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 d23eccfa7..9c90e6d04 100644 --- a/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs +++ b/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs @@ -99,7 +99,7 @@ namespace System.Management.Automation.Runspaces // if _PSSnapin or _reason is empty, this exception is created using default // constructor. Don't create the error record since there is // no useful information anyway. - if (!String.IsNullOrEmpty(_PSSnapin) && !String.IsNullOrEmpty(_reason)) + if (!string.IsNullOrEmpty(_PSSnapin) && !string.IsNullOrEmpty(_reason)) { Assembly currentAssembly = typeof(PSSnapInException).Assembly; diff --git a/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs b/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs index b5285fca8..4508648b3 100644 --- a/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs +++ b/src/System.Management.Automation/utils/CommandDiscoveryExceptions.cs @@ -509,13 +509,13 @@ namespace System.Management.Automation if (forShellId) { - if (String.IsNullOrEmpty(first)) + if (string.IsNullOrEmpty(first)) { resourceStr = DiscoveryExceptions.RequiresShellIDInvalidForSingleShell; } else { - resourceStr = String.IsNullOrEmpty(second) + resourceStr = string.IsNullOrEmpty(second) ? DiscoveryExceptions.RequiresInterpreterNotCompatibleNoPath : DiscoveryExceptions.RequiresInterpreterNotCompatible; } diff --git a/src/System.Management.Automation/utils/CryptoUtils.cs b/src/System.Management.Automation/utils/CryptoUtils.cs index d028da352..9abcff203 100644 --- a/src/System.Management.Automation/utils/CryptoUtils.cs +++ b/src/System.Management.Automation/utils/CryptoUtils.cs @@ -1228,7 +1228,7 @@ namespace System.Management.Automation.Internal /// True on success. internal bool ImportRemotePublicKey(string publicKeyAsString) { - Dbg.Assert(!String.IsNullOrEmpty(publicKeyAsString), "public key passed in cannot be null"); + Dbg.Assert(!string.IsNullOrEmpty(publicKeyAsString), "public key passed in cannot be null"); // generate the crypto provider to use for encryption //_rsaCryptoProvider = GenerateCryptoServiceProvider(false); @@ -1383,7 +1383,7 @@ namespace System.Management.Automation.Internal /// internal bool ImportEncryptedSessionKey(string encryptedSessionKey) { - Dbg.Assert(!String.IsNullOrEmpty(encryptedSessionKey), "encrypted session key passed in cannot be null"); + Dbg.Assert(!string.IsNullOrEmpty(encryptedSessionKey), "encrypted session key passed in cannot be null"); try { diff --git a/src/System.Management.Automation/utils/MshArgumentException.cs b/src/System.Management.Automation/utils/MshArgumentException.cs index 5443c0cf2..597318ca3 100644 --- a/src/System.Management.Automation/utils/MshArgumentException.cs +++ b/src/System.Management.Automation/utils/MshArgumentException.cs @@ -149,7 +149,7 @@ namespace System.Management.Automation /// public override string Message { - get { return String.IsNullOrEmpty(_message) ? base.Message : _message; } + get { return string.IsNullOrEmpty(_message) ? base.Message : _message; } } private string _message; diff --git a/src/System.Management.Automation/utils/MshArgumentNullException.cs b/src/System.Management.Automation/utils/MshArgumentNullException.cs index 535bd6381..50d1c2bc4 100644 --- a/src/System.Management.Automation/utils/MshArgumentNullException.cs +++ b/src/System.Management.Automation/utils/MshArgumentNullException.cs @@ -147,7 +147,7 @@ namespace System.Management.Automation /// public override string Message { - get { return String.IsNullOrEmpty(_message) ? base.Message : _message; } + get { return string.IsNullOrEmpty(_message) ? base.Message : _message; } } private string _message; diff --git a/src/System.Management.Automation/utils/MshTraceSource.cs b/src/System.Management.Automation/utils/MshTraceSource.cs index e3b8d80c5..8e671835b 100644 --- a/src/System.Management.Automation/utils/MshTraceSource.cs +++ b/src/System.Management.Automation/utils/MshTraceSource.cs @@ -98,7 +98,7 @@ namespace System.Management.Automation string description, bool traceHeaders) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { // 2005/04/13-JonN In theory this should be ArgumentException, // but I don't want to deal with loading the string in this @@ -182,7 +182,7 @@ namespace System.Management.Automation string description, bool traceHeaders) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { // Note, all callers should have already verified the name before calling this // API, so this exception should never be exposed to an end-user. @@ -228,7 +228,7 @@ namespace System.Management.Automation /// Exception instance ready to throw. internal static PSArgumentNullException NewArgumentNullException(string paramName) { - if (String.IsNullOrEmpty(paramName)) + if (string.IsNullOrEmpty(paramName)) { throw new ArgumentNullException("paramName"); } @@ -257,12 +257,12 @@ namespace System.Management.Automation internal static PSArgumentNullException NewArgumentNullException( string paramName, string resourceString, params object[] args) { - if (String.IsNullOrEmpty(paramName)) + if (string.IsNullOrEmpty(paramName)) { throw NewArgumentNullException("paramName"); } - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw NewArgumentNullException("resourceString"); } @@ -287,7 +287,7 @@ namespace System.Management.Automation /// Exception instance ready to throw. internal static PSArgumentException NewArgumentException(string paramName) { - if (String.IsNullOrEmpty(paramName)) + if (string.IsNullOrEmpty(paramName)) { throw new ArgumentNullException("paramName"); } @@ -317,12 +317,12 @@ namespace System.Management.Automation internal static PSArgumentException NewArgumentException( string paramName, string resourceString, params object[] args) { - if (String.IsNullOrEmpty(paramName)) + if (string.IsNullOrEmpty(paramName)) { throw NewArgumentNullException("paramName"); } - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw NewArgumentNullException("resourceString"); } @@ -364,7 +364,7 @@ namespace System.Management.Automation internal static PSInvalidOperationException NewInvalidOperationException( string resourceString, params object[] args) { - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw NewArgumentNullException("resourceString"); } @@ -394,7 +394,7 @@ namespace System.Management.Automation Exception innerException, string resourceString, params object[] args) { - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw NewArgumentNullException("resourceString"); } @@ -436,7 +436,7 @@ namespace System.Management.Automation string resourceString, params object[] args) { - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw NewArgumentNullException("resourceString"); } @@ -477,7 +477,7 @@ namespace System.Management.Automation /// Exception instance ready to throw. internal static PSArgumentOutOfRangeException NewArgumentOutOfRangeException(string paramName, object actualValue) { - if (String.IsNullOrEmpty(paramName)) + if (string.IsNullOrEmpty(paramName)) { throw new ArgumentNullException("paramName"); } @@ -509,12 +509,12 @@ namespace System.Management.Automation internal static PSArgumentOutOfRangeException NewArgumentOutOfRangeException( string paramName, object actualValue, string resourceString, params object[] args) { - if (String.IsNullOrEmpty(paramName)) + if (string.IsNullOrEmpty(paramName)) { throw NewArgumentNullException("paramName"); } - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw NewArgumentNullException("resourceString"); } @@ -540,7 +540,7 @@ namespace System.Management.Automation /// internal static PSObjectDisposedException NewObjectDisposedException(string objectName) { - if (String.IsNullOrEmpty(objectName)) + if (string.IsNullOrEmpty(objectName)) { throw NewArgumentNullException("objectName"); } diff --git a/src/System.Management.Automation/utils/ParameterBinderExceptions.cs b/src/System.Management.Automation/utils/ParameterBinderExceptions.cs index ee27aa721..af1970009 100644 --- a/src/System.Management.Automation/utils/ParameterBinderExceptions.cs +++ b/src/System.Management.Automation/utils/ParameterBinderExceptions.cs @@ -84,12 +84,12 @@ namespace System.Management.Automation params object[] args) : base(errorCategory, invocationInfo, errorPosition, errorId, null, null) { - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw PSTraceSource.NewArgumentException("resourceString"); } - if (String.IsNullOrEmpty(errorId)) + if (string.IsNullOrEmpty(errorId)) { throw PSTraceSource.NewArgumentException("errorId"); } @@ -197,12 +197,12 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("invocationInfo"); } - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw PSTraceSource.NewArgumentException("resourceString"); } - if (String.IsNullOrEmpty(errorId)) + if (string.IsNullOrEmpty(errorId)) { throw PSTraceSource.NewArgumentException("errorId"); } @@ -251,7 +251,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("pbex"); } - if (String.IsNullOrEmpty(resourceString)) + if (string.IsNullOrEmpty(resourceString)) { throw PSTraceSource.NewArgumentException("resourceString"); } @@ -508,7 +508,7 @@ namespace System.Management.Automation string result = String.Empty; - if (!String.IsNullOrEmpty(_resourceString)) + if (!string.IsNullOrEmpty(_resourceString)) { result = StringUtil.Format(_resourceString, messageArgs); } diff --git a/src/System.Management.Automation/utils/PsUtils.cs b/src/System.Management.Automation/utils/PsUtils.cs index 6ea59062c..1b2948293 100644 --- a/src/System.Management.Automation/utils/PsUtils.cs +++ b/src/System.Management.Automation/utils/PsUtils.cs @@ -222,7 +222,7 @@ namespace System.Management.Automation System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties(); string hostname = ipProperties.HostName; - if (!String.IsNullOrEmpty(ipProperties.DomainName)) + if (!string.IsNullOrEmpty(ipProperties.DomainName)) { hostname = hostname + "." + ipProperties.DomainName; } diff --git a/src/System.Management.Automation/utils/ResourceManagerCache.cs b/src/System.Management.Automation/utils/ResourceManagerCache.cs index 6265ddfde..37982e9ac 100644 --- a/src/System.Management.Automation/utils/ResourceManagerCache.cs +++ b/src/System.Management.Automation/utils/ResourceManagerCache.cs @@ -46,7 +46,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("assembly"); } - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) { throw PSTraceSource.NewArgumentException("baseName"); } @@ -156,12 +156,12 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("assembly"); } - if (String.IsNullOrEmpty(baseName)) + if (string.IsNullOrEmpty(baseName)) { throw PSTraceSource.NewArgumentException("baseName"); } - if (String.IsNullOrEmpty(resourceId)) + if (string.IsNullOrEmpty(resourceId)) { throw PSTraceSource.NewArgumentException("resourceId"); } @@ -198,7 +198,7 @@ namespace System.Management.Automation text = resourceManager.GetString(resourceId); } - if (String.IsNullOrEmpty(text) && s_DFT_monitorFailingResourceLookup) + if (string.IsNullOrEmpty(text) && s_DFT_monitorFailingResourceLookup) { Diagnostics.Assert(false, "Lookup failure: baseName " + baseName + " resourceId " + resourceId); diff --git a/src/System.Management.Automation/utils/RuntimeException.cs b/src/System.Management.Automation/utils/RuntimeException.cs index 728b41dc1..3f13f410f 100644 --- a/src/System.Management.Automation/utils/RuntimeException.cs +++ b/src/System.Management.Automation/utils/RuntimeException.cs @@ -227,7 +227,7 @@ namespace System.Management.Automation if (errorRecord == null) return string.Empty; if (null != errorRecord.ErrorDetails && - !String.IsNullOrEmpty(errorRecord.ErrorDetails.Message)) + !string.IsNullOrEmpty(errorRecord.ErrorDetails.Message)) { return errorRecord.ErrorDetails.Message; } @@ -252,7 +252,7 @@ namespace System.Management.Automation if (ed == null) return e.Message; string detailsMessage = ed.Message; - return (String.IsNullOrEmpty(detailsMessage)) ? e.Message : detailsMessage; + return (string.IsNullOrEmpty(detailsMessage)) ? e.Message : detailsMessage; } internal static Exception RetrieveException(ErrorRecord errorRecord) diff --git a/src/System.Management.Automation/utils/SessionStateExceptions.cs b/src/System.Management.Automation/utils/SessionStateExceptions.cs index 3a286be89..9d460f31c 100644 --- a/src/System.Management.Automation/utils/SessionStateExceptions.cs +++ b/src/System.Management.Automation/utils/SessionStateExceptions.cs @@ -267,7 +267,7 @@ namespace System.Management.Automation return string.Empty; } - if (String.IsNullOrEmpty(errorId)) + if (string.IsNullOrEmpty(errorId)) { Diagnostics.Assert(false, "ProviderInvocationException.RetrieveMessage needs errorId"); @@ -282,7 +282,7 @@ namespace System.Management.Automation } string format = resourceStr; - if (String.IsNullOrEmpty(format)) + if (string.IsNullOrEmpty(format)) { Diagnostics.Assert(false, "ProviderInvocationException.RetrieveMessage bad errorId " + errorId); @@ -319,7 +319,7 @@ namespace System.Management.Automation /// public override string Message { - get { return (String.IsNullOrEmpty(_message)) ? base.Message : _message; } + get { return (string.IsNullOrEmpty(_message)) ? base.Message : _message; } } [NonSerialized] diff --git a/src/System.Management.Automation/utils/StructuredTraceSource.cs b/src/System.Management.Automation/utils/StructuredTraceSource.cs index a45f91086..aeeef0590 100644 --- a/src/System.Management.Automation/utils/StructuredTraceSource.cs +++ b/src/System.Management.Automation/utils/StructuredTraceSource.cs @@ -269,7 +269,7 @@ namespace System.Management.Automation /// internal PSTraceSource(string fullName, string name, string description, bool traceHeaders) { - if (String.IsNullOrEmpty(fullName)) + if (string.IsNullOrEmpty(fullName)) { // 2005/04/13-JonN In theory this should be ArgumentException, // but I don't want to deal with loading the string in this @@ -1686,7 +1686,7 @@ namespace System.Management.Automation StringBuilder output = new StringBuilder(); - if (!String.IsNullOrEmpty(scopeOutputFormatter)) + if (!string.IsNullOrEmpty(scopeOutputFormatter)) { output.AppendFormat( CultureInfo.CurrentCulture, @@ -1694,7 +1694,7 @@ namespace System.Management.Automation _scopeName); } - if (!String.IsNullOrEmpty(format)) + if (!string.IsNullOrEmpty(format)) { output.AppendFormat( CultureInfo.CurrentCulture, @@ -1723,7 +1723,7 @@ namespace System.Management.Automation // Trace out the scope name - if (!String.IsNullOrEmpty(_leavingScopeFormatter)) + if (!string.IsNullOrEmpty(_leavingScopeFormatter)) { _tracer.OutputLine(_flag, _leavingScopeFormatter, _scopeName); }