From e177fcaef610f874aa31cd3d85f97162d2859e72 Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 13 Jun 2018 00:30:10 +0500 Subject: [PATCH] CodeFactor code style cleanup: replace literal empty strings with 'string.Empty' (#6950) --- .../CommonUtils.cs | 2 +- .../CounterSample.cs | 4 +- .../CounterSet.cs | 4 +- .../GetEventCommand.cs | 38 +-- .../ImportCounterCommand.cs | 10 +- .../PdhHelper.cs | 12 +- .../commands/management/Computer.cs | 4 +- .../management/ControlPanelItemCommand.cs | 4 +- .../commands/management/Eventlog.cs | 4 +- .../commands/management/Process.cs | 6 +- .../commands/management/WMIHelper.cs | 2 +- .../commands/utility/CSVCommands.cs | 8 +- .../commands/utility/Csv.cs | 8 +- .../commands/utility/GetHash.cs | 6 +- .../commands/utility/GetMember.cs | 2 +- .../commands/utility/MatchString.cs | 4 +- .../commands/utility/Measure-Object.cs | 2 +- .../commands/utility/ReadConsoleCmdlet.cs | 2 +- .../Common/WebRequestPSCmdlet.Common.cs | 16 +- .../commands/utility/WriteConsoleCmdlet.cs | 2 +- .../commands/utility/convert-HTML.cs | 4 +- .../utility/trace/MshHostTraceListener.cs | 2 +- .../commands/utility/write.cs | 12 +- .../host/msh/CommandLineParameterParser.cs | 4 +- .../host/msh/ConsoleHost.cs | 6 +- .../host/msh/ConsoleHostUserInterface.cs | 12 +- ...ConsoleHostUserInterfacePromptForChoice.cs | 8 +- .../host/msh/ProgressNode.cs | 8 +- .../Microsoft.PowerShell.PSReadLine.csproj | 12 - .../security/CatalogCommands.cs | 2 +- .../security/CertificateProvider.cs | 4 +- .../security/SignatureCommands.cs | 2 +- .../security/Utils.cs | 2 +- .../ConfigProvider.cs | 32 +-- src/Microsoft.WSMan.Management/Interop.cs | 16 +- .../Set-QuickConfig.cs | 6 +- src/Microsoft.WSMan.Management/WsManHelper.cs | 4 +- .../CoreCLR/CorePsPlatform.cs | 2 +- .../DscSupport/CimDSCParser.cs | 20 +- .../common/BaseOutputtingCommand.cs | 24 +- .../FormatAndOutput/common/ComplexWriter.cs | 2 +- .../DisplayDatabase/displayDescriptionData.cs | 2 +- .../common/FormatViewGenerator.cs | 2 +- .../common/FormatViewGenerator_Complex.cs | 4 +- .../common/FormatViewGenerator_Table.cs | 2 +- .../common/FormatViewManager.cs | 2 +- .../FormatAndOutput/common/FormatXMLWriter.cs | 12 +- .../FormatAndOutput/common/ListWriter.cs | 8 +- .../FormatAndOutput/common/TableWriter.cs | 4 +- .../common/Utilities/MshObjectUtil.cs | 12 +- ...lets-over-objects.xmlSerializer.autogen.cs | 54 ++--- ...lets-over-objects.xmlSerializer.autogen.cs | 222 ++++++++--------- .../engine/AutomationEngine.cs | 2 +- .../engine/COM/ComUtil.cs | 2 +- .../engine/CmdletInfo.cs | 4 +- .../engine/ComInterop/VarEnumSelector.cs | 2 +- .../CommandCompletion/CompletionAnalysis.cs | 4 +- .../CommandCompletion/CompletionCompleters.cs | 16 +- .../engine/CommandDiscovery.cs | 2 +- .../engine/CommandInfo.cs | 2 +- .../engine/CommandMetadata.cs | 8 +- .../engine/Credential.cs | 2 +- .../engine/DataStoreAdapterProvider.cs | 6 +- .../engine/ErrorPackage.cs | 44 ++-- .../engine/InitialSessionState.cs | 226 +++++++++--------- .../engine/InvocationInfo.cs | 4 +- .../engine/ManagementObjectAdapter.cs | 2 +- .../engine/Modules/ImportModuleCommand.cs | 4 +- .../engine/Modules/ModuleCmdletBase.cs | 12 +- .../Modules/NewModuleManifestCommand.cs | 14 +- .../engine/Modules/RemoteDiscoveryHelper.cs | 4 +- .../engine/Modules/ScriptAnalysis.cs | 2 +- .../Modules/TestModuleManifestCommand.cs | 2 +- .../engine/MshMemberInfo.cs | 4 +- .../engine/MshObject.cs | 2 +- .../engine/NativeCommandParameterBinder.cs | 4 +- .../engine/ParameterBinderBase.cs | 8 +- .../engine/ProxyCommand.cs | 2 +- .../engine/SessionState.cs | 2 +- .../engine/SessionStatePublic.cs | 2 +- .../engine/TransactedString.cs | 2 +- .../engine/TypeMetadata.cs | 12 +- .../engine/Types_Ps1Xml.cs | 4 +- .../engine/VariableAttributeCollection.cs | 2 +- .../engine/WorkflowInfo.cs | 2 +- .../engine/cmdlet.cs | 2 +- .../engine/debugger/debugger.cs | 14 +- .../engine/hostifaces/ChoiceDescription.cs | 2 +- .../engine/hostifaces/Command.cs | 2 +- .../engine/hostifaces/FieldDescription.cs | 4 +- .../engine/hostifaces/HostUtilities.cs | 2 +- .../hostifaces/InternalHostUserInterface.cs | 6 +- .../engine/hostifaces/MshHostUserInterface.cs | 2 +- .../hostifaces/NativeCultureResolver.cs | 2 +- .../engine/hostifaces/PowerShell.cs | 2 +- .../interpreter/ControlFlowInstructions.cs | 4 +- .../engine/interpreter/Instruction.cs | 2 +- .../engine/interpreter/InstructionList.cs | 4 +- .../engine/lang/parserutils.cs | 12 +- .../engine/parser/Compiler.cs | 10 +- .../engine/parser/DebugViewWriter.cs | 4 +- .../engine/parser/Position.cs | 10 +- .../engine/parser/SemanticChecks.cs | 6 +- .../engine/parser/VariableAnalysis.cs | 4 +- .../engine/parser/ast.cs | 2 +- .../engine/parser/token.cs | 40 ++-- .../engine/parser/tokenizer.cs | 4 +- .../engine/pipeline.cs | 6 +- .../engine/remoting/client/Job.cs | 4 +- .../client/RemoteRunspacePoolInternal.cs | 2 +- .../remoting/commands/CustomShellCommands.cs | 2 +- .../commands/NewPSSessionConfigurationFile.cs | 2 +- .../remoting/commands/ReceivePSSession.cs | 2 +- .../remoting/common/RemoteSessionNamedPipe.cs | 2 +- .../engine/remoting/fanin/WSManNativeAPI.cs | 4 +- .../server/OutOfProcServerMediator.cs | 4 +- .../remoting/server/serverremotesession.cs | 2 +- .../engine/runtime/Binding/Binders.cs | 20 +- .../engine/runtime/CompiledScriptBlock.cs | 4 +- .../engine/runtime/ScriptBlockToPowerShell.cs | 2 +- .../help/AliasHelpInfo.cs | 4 +- .../help/AliasHelpProvider.cs | 2 +- .../help/BaseCommandHelpInfo.cs | 22 +- .../help/CommandHelpProvider.cs | 4 +- .../help/DefaultCommandHelpObjectBuilder.cs | 14 +- .../help/HelpCommands.cs | 4 +- .../help/HelpCommentsParser.cs | 8 +- .../help/HelpErrorTracer.cs | 2 +- .../help/HelpFileHelpInfo.cs | 8 +- .../help/HelpInfo.cs | 2 +- .../help/HelpNotFoundException.cs | 2 +- .../help/HelpSystem.cs | 22 +- .../help/MUIFileSearcher.cs | 2 +- .../help/MamlNode.cs | 16 +- .../help/MamlUtil.cs | 4 +- .../help/ProviderHelpInfo.cs | 22 +- .../help/SyntaxHelpInfo.cs | 4 +- .../help/UpdatableHelpSystem.cs | 2 +- .../logging/LogContext.cs | 30 +-- .../logging/eventlog/EventLogLogProvider.cs | 24 +- .../namespaces/FileSystemProvider.cs | 22 +- .../namespaces/LocationGlobber.cs | 8 +- .../namespaces/RegistryProvider.cs | 8 +- .../namespaces/TransactedRegistryKey.cs | 2 +- .../security/CatalogHelper.cs | 2 +- .../security/CredentialParameter.cs | 2 +- .../security/SecureStringHelper.cs | 2 +- .../security/SecuritySupport.cs | 6 +- .../security/nativeMethods.cs | 2 +- .../security/wldpNativeMethods.cs | 2 +- .../config/MshSnapinLoadException.cs | 4 +- .../utils/FormatAndTypeDataHelper.cs | 4 +- .../utils/PowerShellETWTracer.cs | 2 +- .../utils/RuntimeException.cs | 6 +- .../utils/SessionStateExceptions.cs | 2 +- .../utils/StructuredTraceSource.cs | 6 +- .../utils/tracing/PSEtwLog.cs | 2 +- test/csharp/test_FileSystemProvider.cs | 4 +- test/csharp/test_SecuritySupport.cs | 2 +- .../Controllers/RedirectController.cs | 2 +- 160 files changed, 765 insertions(+), 777 deletions(-) delete mode 100644 src/Microsoft.PowerShell.PSReadLine/Microsoft.PowerShell.PSReadLine.csproj diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs index 13b3eece1..c128e39bc 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs @@ -26,7 +26,7 @@ namespace Microsoft.PowerShell.Commands.Diagnostics.Common // public static string StringArrayToString(IEnumerable input) { - string ret = ""; + string ret = string.Empty; foreach (string element in input) { ret += element + ", "; diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSample.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSample.cs index 7732b2036..572284b89 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSample.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSample.cs @@ -51,14 +51,14 @@ namespace Microsoft.PowerShell.Commands.GetCounter get { return _path; } set { _path = value; } } - private string _path = ""; + private string _path = string.Empty; public string InstanceName { get { return _instanceName; } set { _instanceName = value; } } - private string _instanceName = ""; + private string _instanceName = string.Empty; public double CookedValue { diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSet.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSet.cs index d981700a1..c7c304558 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSet.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/CounterSet.cs @@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter return _counterSetName; } } - private string _counterSetName = ""; + private string _counterSetName = string.Empty; public string MachineName { @@ -70,7 +70,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter return _description; } } - private string _description = ""; + private string _description = string.Empty; internal Dictionary CounterInstanceMapping { diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs index 78b64e74b..13c492868 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs @@ -836,7 +836,7 @@ namespace Microsoft.PowerShell.Commands // // Force the destruction of cached password // - netCred.Password = ""; + netCred.Password = string.Empty; return eventLogSession; } @@ -973,12 +973,12 @@ namespace Microsoft.PowerShell.Commands // private string BuildXPathFromHashTable(Hashtable hash) { - StringBuilder xpathString = new StringBuilder(""); + StringBuilder xpathString = new StringBuilder(string.Empty); bool bDateTimeHandled = false; foreach (string key in hash.Keys) { - string added = ""; + string added = string.Empty; switch (key.ToLowerInvariant()) { @@ -1062,7 +1062,7 @@ namespace Microsoft.PowerShell.Commands // private string BuildStructuredQueryFromHashTable(EventLogSession eventLogSession) { - StringBuilder result = new StringBuilder(""); + StringBuilder result = new StringBuilder(string.Empty); result.Append(queryListOpen); @@ -1070,8 +1070,8 @@ namespace Microsoft.PowerShell.Commands foreach (Hashtable hash in _selector) { - string xpathString = ""; - string xpathStringSuppress = ""; + string xpathString = string.Empty; + string xpathStringSuppress = string.Empty; CheckHashTableForQueryPathPresence(hash); @@ -1378,7 +1378,7 @@ namespace Microsoft.PowerShell.Commands { if (!KeywordStringToInt64(value.ToString(), ref keywordLong)) { - return ""; + return string.Empty; } keywordsMask |= keywordLong; } @@ -1416,7 +1416,7 @@ namespace Microsoft.PowerShell.Commands string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("InvalidContext"), value.ToString()); Exception outerExc = new Exception(msg, exc); WriteError(new ErrorRecord(outerExc, "InvalidContext", ErrorCategory.InvalidArgument, null)); - return ""; + return string.Empty; } } @@ -1434,7 +1434,7 @@ namespace Microsoft.PowerShell.Commands DateTime startTime = new DateTime(); if (!StringToDateTime(value.ToString(), ref startTime)) { - return ""; + return string.Empty; } startTime = startTime.ToUniversalTime(); @@ -1445,7 +1445,7 @@ namespace Microsoft.PowerShell.Commands DateTime endTime = new DateTime(); if (!StringToDateTime(hash[hashkey_endtime_lc].ToString(), ref endTime)) { - return ""; + return string.Empty; } endTime = endTime.ToUniversalTime(); @@ -1477,7 +1477,7 @@ namespace Microsoft.PowerShell.Commands DateTime endTime = new DateTime(); if (!StringToDateTime(value.ToString(), ref endTime)) { - return ""; + return string.Empty; } endTime = endTime.ToUniversalTime(); @@ -1489,7 +1489,7 @@ namespace Microsoft.PowerShell.Commands DateTime startTime = new DateTime(); if (!StringToDateTime(hash[hashkey_starttime_lc].ToString(), ref startTime)) { - return ""; + return string.Empty; } startTime = startTime.ToUniversalTime(); @@ -1709,27 +1709,27 @@ namespace Microsoft.PowerShell.Commands } catch (PSNotSupportedException notSupported) { - WriteError(new ErrorRecord(notSupported, "", ErrorCategory.ObjectNotFound, path)); + WriteError(new ErrorRecord(notSupported, string.Empty, ErrorCategory.ObjectNotFound, path)); return retColl; } catch (System.Management.Automation.DriveNotFoundException driveNotFound) { - WriteError(new ErrorRecord(driveNotFound, "", ErrorCategory.ObjectNotFound, path)); + WriteError(new ErrorRecord(driveNotFound, string.Empty, ErrorCategory.ObjectNotFound, path)); return retColl; } catch (ProviderNotFoundException providerNotFound) { - WriteError(new ErrorRecord(providerNotFound, "", ErrorCategory.ObjectNotFound, path)); + WriteError(new ErrorRecord(providerNotFound, string.Empty, ErrorCategory.ObjectNotFound, path)); return retColl; } catch (ItemNotFoundException pathNotFound) { - WriteError(new ErrorRecord(pathNotFound, "", ErrorCategory.ObjectNotFound, path)); + WriteError(new ErrorRecord(pathNotFound, string.Empty, ErrorCategory.ObjectNotFound, path)); return retColl; } catch (Exception exc) { - WriteError(new ErrorRecord(exc, "", ErrorCategory.ObjectNotFound, path)); + WriteError(new ErrorRecord(exc, string.Empty, ErrorCategory.ObjectNotFound, path)); return retColl; } @@ -1859,7 +1859,7 @@ namespace Microsoft.PowerShell.Commands { if (providers.Count == 0) { - return ""; + return string.Empty; } StringBuilder predicate = new StringBuilder("System/Provider["); @@ -1887,7 +1887,7 @@ namespace Microsoft.PowerShell.Commands { if (_providersByLogMap.Count == 0) { - return ""; + return string.Empty; } StringBuilder predicate = new StringBuilder("System/Provider["); diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs index b9275784f..5e21ce504 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs @@ -568,27 +568,27 @@ namespace Microsoft.PowerShell.Commands } catch (PSNotSupportedException notSupported) { - WriteError(new ErrorRecord(notSupported, "", ErrorCategory.ObjectNotFound, origPath)); + WriteError(new ErrorRecord(notSupported, string.Empty, ErrorCategory.ObjectNotFound, origPath)); continue; } catch (System.Management.Automation.DriveNotFoundException driveNotFound) { - WriteError(new ErrorRecord(driveNotFound, "", ErrorCategory.ObjectNotFound, origPath)); + WriteError(new ErrorRecord(driveNotFound, string.Empty, ErrorCategory.ObjectNotFound, origPath)); continue; } catch (ProviderNotFoundException providerNotFound) { - WriteError(new ErrorRecord(providerNotFound, "", ErrorCategory.ObjectNotFound, origPath)); + WriteError(new ErrorRecord(providerNotFound, string.Empty, ErrorCategory.ObjectNotFound, origPath)); continue; } catch (ItemNotFoundException pathNotFound) { - WriteError(new ErrorRecord(pathNotFound, "", ErrorCategory.ObjectNotFound, origPath)); + WriteError(new ErrorRecord(pathNotFound, string.Empty, ErrorCategory.ObjectNotFound, origPath)); continue; } catch (Exception exc) { - WriteError(new ErrorRecord(exc, "", ErrorCategory.ObjectNotFound, origPath)); + WriteError(new ErrorRecord(exc, string.Empty, ErrorCategory.ObjectNotFound, origPath)); continue; } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs index d42d6a2f6..9a569f3c0 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs @@ -474,7 +474,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative { Debug.Assert(strSize >= 2); int offset = 0; - string allSubstringsWithNulls = ""; + string allSubstringsWithNulls = string.Empty; while (offset <= ((strSize * sizeof(char)) - 4)) { Int32 next4 = Marshal.ReadInt32(strNative, offset); @@ -580,7 +580,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative return ConnectToDataSource(blgFileNames[0]); } - string doubleNullTerminated = ""; + string doubleNullTerminated = string.Empty; foreach (string fileName in blgFileNames) { doubleNullTerminated += fileName + '\0'; @@ -826,7 +826,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative private bool IsPathValid(ref PDH_COUNTER_PATH_ELEMENTS pathElts, out string outPath) { bool ret = false; - outPath = ""; + outPath = string.Empty; IntPtr pPathBufferSize = new IntPtr(0); uint res = PdhMakeCounterPath(ref pathElts, IntPtr.Zero, ref pPathBufferSize, 0); @@ -880,7 +880,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative private uint MakePath(PDH_COUNTER_PATH_ELEMENTS pathElts, out string outPath, bool bWildcardInstances) { - outPath = ""; + outPath = string.Empty; IntPtr pPathBufferSize = new IntPtr(0); if (bWildcardInstances) @@ -984,7 +984,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative public uint TranslateLocalCounterPath(string englishPath, out string localizedPath) { uint res = 0; - localizedPath = ""; + localizedPath = string.Empty; PDH_COUNTER_PATH_ELEMENTS pathElts = new PDH_COUNTER_PATH_ELEMENTS(); res = ParsePath(englishPath, ref pathElts); if (res != 0) @@ -1077,7 +1077,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative int strSize = 256; IntPtr localizedPathPtr = Marshal.AllocHGlobal(strSize * sizeof(char)); - locName = ""; + locName = string.Empty; uint res = 0; try { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index 860f12ec5..bf00769c7 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -352,7 +352,7 @@ $result private readonly string _shortLocalMachineName = Dns.GetHostName(); // And for this, use PsUtils.GetHostname() - private readonly string _fullLocalMachineName = Dns.GetHostEntryAsync("").Result.HostName; + private readonly string _fullLocalMachineName = Dns.GetHostEntryAsync(string.Empty).Result.HostName; private int _percent; private string _status; @@ -1269,7 +1269,7 @@ $result private string _newNameForLocalHost = null; private readonly string _shortLocalMachineName = Dns.GetHostName(); - private readonly string _fullLocalMachineName = Dns.GetHostEntryAsync("").Result.HostName; + private readonly string _fullLocalMachineName = Dns.GetHostEntryAsync(string.Empty).Result.HostName; #endregion diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs index 8c8dcbe2e..2b203709c 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs @@ -253,7 +253,7 @@ $result { Dbg.Assert(installation != null, "the CurrentVersion subkey should exist"); - string installationType = (string)installation.GetValue("InstallationType", ""); + string installationType = (string)installation.GetValue("InstallationType", string.Empty); if (installationType.Equals("Server Core")) { @@ -429,7 +429,7 @@ $result string errMsg = withCategoryFilter ? ControlPanelResources.NoControlPanelItemFoundWithNullCanonicalNameWithCategory : ControlPanelResources.NoControlPanelItemFoundWithNullCanonicalName; - ErrorRecord error = new ErrorRecord(new InvalidOperationException(errMsg), "", + ErrorRecord error = new ErrorRecord(new InvalidOperationException(errMsg), string.Empty, ErrorCategory.InvalidArgument, CanonicalNames); WriteError(error); } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs index eececdd3d..1b88bd868 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs @@ -433,7 +433,7 @@ namespace Microsoft.PowerShell.Commands } if (!matchesfound && _isThrowError) { - Exception Ex = new ArgumentException(StringUtil.Format(EventlogResources.NoEntriesFound, log.Log, "")); + Exception Ex = new ArgumentException(StringUtil.Format(EventlogResources.NoEntriesFound, log.Log, string.Empty)); WriteError(new ErrorRecord(Ex, "GetEventLogNoEntriesFound", ErrorCategory.ObjectNotFound, null)); } } @@ -1372,7 +1372,7 @@ namespace Microsoft.PowerShell.Commands } else { - ErrorRecord er = new ErrorRecord(new InvalidOperationException(StringUtil.Format(EventlogResources.SourceDoesNotExist, "", computer, src)), null, ErrorCategory.InvalidOperation, null); + ErrorRecord er = new ErrorRecord(new InvalidOperationException(StringUtil.Format(EventlogResources.SourceDoesNotExist, string.Empty, computer, src)), null, ErrorCategory.InvalidOperation, null); WriteError(er); continue; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs index 0ac971561..3e975299b 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs @@ -347,7 +347,7 @@ namespace Microsoft.PowerShell.Commands string message = StringUtil.Format(resourceId, processName, processId, - (null == innerException) ? "" : innerException.Message); + (null == innerException) ? string.Empty : innerException.Message); ProcessCommandException exception = new ProcessCommandException(message, innerException); exception.ProcessName = processName; @@ -366,11 +366,11 @@ namespace Microsoft.PowerShell.Commands } catch (Win32Exception) { - return ""; + return string.Empty; } catch (InvalidOperationException) { - return ""; + return string.Empty; } } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs index aa62d0301..117878c30 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs @@ -676,7 +676,7 @@ namespace Microsoft.PowerShell.Commands string localName = System.Net.Dns.GetHostName(); // And for this, use PsUtils.GetHostname() - string localFullName = System.Net.Dns.GetHostEntry("").HostName; + string localFullName = System.Net.Dns.GetHostEntry(string.Empty).HostName; if (computer.Equals(".") || computer.Equals("localhost", StringComparison.OrdinalIgnoreCase) || computer.Equals(localName, StringComparison.OrdinalIgnoreCase) || computer.Equals(localFullName, StringComparison.OrdinalIgnoreCase)) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs index 0c20b2974..4c0a67d72 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs @@ -725,13 +725,13 @@ namespace Microsoft.PowerShell.Commands } //Write property information string properties = _helper.ConvertPropertyNamesCSV(_propertyNames); - if (!properties.Equals("")) + if (!properties.Equals(string.Empty)) WriteCsvLine(properties); } string csv = _helper.ConvertPSObjectToCSV(InputObject, _propertyNames); //write to the console - if (csv != "") + if (csv != string.Empty) WriteCsvLine(csv); } @@ -1539,7 +1539,7 @@ namespace Microsoft.PowerShell.Commands bool IsNewLine(char ch, out string newLine) { - newLine = ""; + newLine = string.Empty; if (ch == '\r') { if (PeekNextChar('\n')) @@ -1557,7 +1557,7 @@ namespace Microsoft.PowerShell.Commands newLine = "\n"; } - return newLine != ""; + return newLine != string.Empty; } /// diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs index bce8acb12..4dcf20277 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs @@ -32,7 +32,7 @@ namespace Microsoft.PowerShell.Commands internal Collection ParseCsv(string csv) { Collection result = new Collection(); - string tempString = ""; + string tempString = string.Empty; csv = csv.Trim(); if (csv.Length == 0 || csv[0] == '#') { @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Commands if (!inQuote) { result.Add(tempString); - tempString = ""; + tempString = string.Empty; } else { @@ -66,7 +66,7 @@ namespace Microsoft.PowerShell.Commands if (i == csv.Length - 1) { result.Add(tempString); - tempString = ""; + tempString = string.Empty; inQuote = false; break; } @@ -74,7 +74,7 @@ namespace Microsoft.PowerShell.Commands if (csv[i + 1] == Delimiter) { result.Add(tempString); - tempString = ""; + tempString = string.Empty; inQuote = false; i++; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetHash.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetHash.cs index f9d3bb8cf..45ebccbb3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetHash.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetHash.cs @@ -131,7 +131,7 @@ namespace Microsoft.PowerShell.Commands openfilestream = File.OpenRead(path); bytehash = hasher.ComputeHash(openfilestream); - hash = BitConverter.ToString(bytehash).Replace("-",""); + hash = BitConverter.ToString(bytehash).Replace("-", string.Empty); WriteHashResult(Algorithm, hash, path); } catch (FileNotFoundException ex) @@ -162,8 +162,8 @@ namespace Microsoft.PowerShell.Commands bytehash = hasher.ComputeHash(InputStream); - hash = BitConverter.ToString(bytehash).Replace("-",""); - WriteHashResult(Algorithm, hash, ""); + hash = BitConverter.ToString(bytehash).Replace("-", string.Empty); + WriteHashResult(Algorithm, hash, string.Empty); } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs index 6806d930b..e59ceaa23 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs @@ -173,7 +173,7 @@ namespace Microsoft.PowerShell.Commands } else { - _typesAlreadyDisplayed.Add(typeName, ""); + _typesAlreadyDisplayed.Add(typeName, string.Empty); } PSMemberTypes memberTypeToSearch = MemberType; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs index 5961b4750..82d0ba293 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs @@ -94,7 +94,7 @@ namespace Microsoft.PowerShell.Commands /// Returns the text of the matching line. /// /// The text of the matching line. - public string Line { get; set; } = ""; + public string Line { get; set; } = string.Empty; /// /// Returns the base name of the file containing the matching line. @@ -970,7 +970,7 @@ namespace Microsoft.PowerShell.Commands } set { - _inputObject = LanguagePrimitives.IsNull(value) ? PSObject.AsPSObject("") : value; + _inputObject = LanguagePrimitives.IsNull(value) ? PSObject.AsPSObject(string.Empty) : value; } } private PSObject _inputObject = AutomationNull.Value; 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 62bebc4d2..894eda444 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs @@ -551,7 +551,7 @@ namespace Microsoft.PowerShell.Commands if (_measureCharacters || _measureWords || _measureLines) { - string strValue = (objValue == null) ? "" : objValue.ToString(); + string strValue = (objValue == null) ? string.Empty : objValue.ToString(); AnalyzeString(strValue, stat); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs index a6d8962b9..98272d24f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ReadConsoleCmdlet.cs @@ -141,7 +141,7 @@ namespace Microsoft.PowerShell.Commands Collection fdc = new Collection(); fdc.Add(fd); - Dictionary result = Host.UI.Prompt("", "", fdc); + Dictionary result = Host.UI.Prompt(string.Empty, string.Empty, fdc); // Result can be null depending on the host implementation. One typical // example of a null return is for a canceled dialog. if (result != null) 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 49faf0914..5c02d7e3f 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 @@ -306,7 +306,7 @@ namespace Microsoft.PowerShell.Commands public virtual object Body { get; set; } /// - /// Dictionary for use with RFC-7578 multipart/form-data submissions. + /// Dictionary for use with RFC-7578 multipart/form-data submissions. /// Keys are form fields and their respective values are form values. /// A value may be a collection of form values or single form value. /// @@ -1310,8 +1310,8 @@ namespace Microsoft.PowerShell.Commands // Request again without the Range header because the server indicated the range was not satisfiable. // This happens when the local file is larger than the remote file. // If the size of the remote file is the same as the local file, there is nothing to resume. - if (Resume.IsPresent && - response.StatusCode == HttpStatusCode.RequestedRangeNotSatisfiable && + if (Resume.IsPresent && + response.StatusCode == HttpStatusCode.RequestedRangeNotSatisfiable && (response.Content.Headers.ContentRange.HasLength && response.Content.Headers.ContentRange.Length != _resumeFileSize)) { @@ -1419,8 +1419,8 @@ namespace Microsoft.PowerShell.Commands // Check if the Resume range was not satisfiable because the file already completed downloading. // This happens when the local file is the same size as the remote file. if (Resume.IsPresent && - response.StatusCode == HttpStatusCode.RequestedRangeNotSatisfiable && - response.Content.Headers.ContentRange.HasLength && + response.StatusCode == HttpStatusCode.RequestedRangeNotSatisfiable && + response.Content.Headers.ContentRange.HasLength && response.Content.Headers.ContentRange.Length == _resumeFileSize) { _isSuccess = true; @@ -1435,13 +1435,13 @@ namespace Microsoft.PowerShell.Commands (int)response.StatusCode, response.ReasonPhrase); HttpResponseException httpEx = new HttpResponseException(message, response); ErrorRecord er = new ErrorRecord(httpEx, "WebCmdletWebResponseException", ErrorCategory.InvalidOperation, request); - string detailMsg = ""; + string detailMsg = string.Empty; StreamReader reader = null; try { reader = new StreamReader(StreamHelper.GetResponseStream(response)); // remove HTML tags making it easier to read - detailMsg = System.Text.RegularExpressions.Regex.Replace(reader.ReadToEnd(), "<[^>]*>",""); + detailMsg = System.Text.RegularExpressions.Regex.Replace(reader.ReadToEnd(), "<[^>]*>", string.Empty); } catch (Exception) { @@ -1779,7 +1779,7 @@ namespace Microsoft.PowerShell.Commands return; } - // Treat Strings and other single values as a StringContent. + // Treat Strings and other single values as a StringContent. // If enumeration is false, also treat IEnumerables as StringContents. // String implements IEnumerable so the explicit check is required. if (enumerate == false || fieldValue is String || !(fieldValue is IEnumerable)) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteConsoleCmdlet.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteConsoleCmdlet.cs index 5aed01c5d..2c0ce8f21 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteConsoleCmdlet.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteConsoleCmdlet.cs @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - string result = ProcessObject(Object) ?? ""; + string result = ProcessObject(Object) ?? string.Empty; HostInformationMessage informationMessage = new HostInformationMessage(); informationMessage.Message = result; 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 3cbcf8e7f..b8e167e0c 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs @@ -384,7 +384,7 @@ namespace Microsoft.PowerShell.Commands { if (obj == null) { - return ""; + return string.Empty; } try { @@ -394,7 +394,7 @@ namespace Microsoft.PowerShell.Commands { // eats exception if safe } - return ""; + return string.Empty; } /// diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/MshHostTraceListener.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/MshHostTraceListener.cs index 0d8b2dd78..c4dbb8365 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/MshHostTraceListener.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/MshHostTraceListener.cs @@ -29,7 +29,7 @@ namespace Microsoft.PowerShell.Commands /// Default constructor used if no. /// internal PSHostTraceListener(PSCmdlet cmdlet) - : base("") + : base(string.Empty) { if (cmdlet == null) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs index 4717ff4db..2bf4ef881 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/write.cs @@ -256,7 +256,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "NoException")] [Parameter(ParameterSetName = "WithException")] - public string ErrorId { get; set; } = ""; + public string ErrorId { get; set; } = string.Empty; /// /// ErrorRecord.TargetObject @@ -269,7 +269,7 @@ namespace Microsoft.PowerShell.Commands /// ErrorRecord.ErrorDetails.RecommendedAction /// [Parameter] - public string RecommendedAction { get; set; } = ""; + public string RecommendedAction { get; set; } = string.Empty; /* 2005/01/25 removing throw-error /// @@ -283,28 +283,28 @@ namespace Microsoft.PowerShell.Commands /// [Parameter] [Alias("Activity")] - public string CategoryActivity { get; set; } = ""; + public string CategoryActivity { get; set; } = string.Empty; /// /// ErrorRecord.CategoryInfo.Reason /// [Parameter] [Alias("Reason")] - public string CategoryReason { get; set; } = ""; + public string CategoryReason { get; set; } = string.Empty; /// /// ErrorRecord.CategoryInfo.TargetName /// [Parameter] [Alias("TargetName")] - public string CategoryTargetName { get; set; } = ""; + public string CategoryTargetName { get; set; } = string.Empty; /// /// ErrorRecord.CategoryInfo.TargetType /// [Parameter] [Alias("TargetType")] - public string CategoryTargetType { get; set; } = ""; + public string CategoryTargetType { get; set; } = string.Empty; /// /// Write an error to the output pipe, or throw a terminating error. diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs index db86a208f..60279b465 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -396,13 +396,13 @@ namespace Microsoft.PowerShell private void ShowHelp() { Dbg.Assert(_helpText != null, "_helpText should not be null"); - _hostUI.WriteLine(""); + _hostUI.WriteLine(string.Empty); _hostUI.Write(_helpText); if (_showExtendedHelp) { _hostUI.Write(ManagedEntranceStrings.ExtendedHelp); } - _hostUI.WriteLine(""); + _hostUI.WriteLine(string.Empty); } private void DisplayBanner() diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index c279d0cce..780fc3e16 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -2137,7 +2137,7 @@ namespace Microsoft.PowerShell if (_displayDebuggerBanner) { WriteDebuggerMessage(ConsoleHostStrings.EnteringDebugger); - WriteDebuggerMessage(""); + WriteDebuggerMessage(string.Empty); _displayDebuggerBanner = false; } @@ -2153,7 +2153,7 @@ namespace Microsoft.PowerShell WriteDebuggerMessage(String.Format(CultureInfo.CurrentCulture, format, breakpoint)); } - WriteDebuggerMessage(""); + WriteDebuggerMessage(string.Empty); } // @@ -2882,7 +2882,7 @@ namespace Microsoft.PowerShell internal Lazy ConsoleIn { get; } = new Lazy(() => Console.In); - private string _savedWindowTitle = ""; + private string _savedWindowTitle = string.Empty; private Version _ver = PSVersionInfo.PSVersion; private int _exitCodeFromRunspace; private bool _noExit = true; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index d15d239cb..debb17695 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -185,7 +185,7 @@ namespace Microsoft.PowerShell // call our internal version such that it does not end input on a tab ReadLineResult unused; - return ReadLine(false, "", out unused, true, true); + return ReadLine(false, string.Empty, out unused, true, true); } /// @@ -1579,7 +1579,7 @@ namespace Microsoft.PowerShell { ConsoleKeyInfo keyInfo; - string s = ""; + string s = string.Empty; int index = 0; int cursorLeft = Console.CursorLeft; int cursorCurrent = cursorLeft; @@ -1588,7 +1588,7 @@ namespace Microsoft.PowerShell #else _rawui.ClearKeyCache(); uint keyState = 0; - string s = ""; + string s = string.Empty; #endif do { @@ -1773,7 +1773,7 @@ namespace Microsoft.PowerShell { Console.CursorLeft = cursorLeft; index = s.Length; - s = ""; + s = string.Empty; continue; } @@ -1897,14 +1897,14 @@ namespace Microsoft.PowerShell internal string ReadLineWithTabCompletion(Executor exec) { string input = null; - string lastInput = ""; + string lastInput = string.Empty; ReadLineResult rlResult = ReadLineResult.endedOnEnter; #if !UNIX ConsoleHandle handle = ConsoleControl.GetActiveScreenBufferHandle(); - string lastCompletion = ""; + string lastCompletion = string.Empty; Size screenBufferSize = RawUI.BufferSize; // Save the cursor position at the end of the prompt string so that we can restore it later to write the diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs index 719d48990..ac50c61f7 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs @@ -107,7 +107,7 @@ namespace Microsoft.PowerShell WriteChoicePrompt(hotkeysAndPlainLabels, defaultChoiceKeys, false); ReadLineResult rlResult; - string response = ReadLine(false, "", out rlResult, true, true); + string response = ReadLine(false, string.Empty, out rlResult, true, true); if (rlResult == ReadLineResult.endedOnBreak) { @@ -253,7 +253,7 @@ namespace Microsoft.PowerShell WriteToConsole(PromptColor, RawUI.BackgroundColor, WrapToCurrentWindowWidth(choiceMsg)); ReadLineResult rlResult; - string response = ReadLine(false, "", out rlResult, true, true); + string response = ReadLine(false, string.Empty, out rlResult, true, true); if (rlResult == ReadLineResult.endedOnBreak) { @@ -353,10 +353,10 @@ namespace Microsoft.PowerShell WriteLineToConsole(); } - string defaultPrompt = ""; + string defaultPrompt = string.Empty; if (defaultChoiceKeys.Count > 0) { - string prepend = ""; + string prepend = string.Empty; StringBuilder defaultChoicesBuilder = new StringBuilder(); foreach (int defaultChoice in defaultChoiceKeys.Keys) { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs index 2529c3192..669190e55 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressNode.cs @@ -297,13 +297,13 @@ namespace Microsoft.PowerShell // Second line: the status description with percentage and time remaining, if applicable. - string percent = ""; + string percent = string.Empty; if (PercentComplete >= 0) { percent = StringUtil.Format("{0}% ", PercentComplete); } - string secRemain = ""; + string secRemain = string.Empty; if (SecondsRemaining >= 0) { TimeSpan span = new TimeSpan(0, 0, SecondsRemaining); @@ -366,13 +366,13 @@ namespace Microsoft.PowerShell // First line: Everything mushed into one line - string percent = ""; + string percent = string.Empty; if (PercentComplete >= 0) { percent = StringUtil.Format("{0}% ", PercentComplete); } - string secRemain = ""; + string secRemain = string.Empty; if (SecondsRemaining >= 0) { TimeSpan span = new TimeSpan(0, 0, SecondsRemaining); diff --git a/src/Microsoft.PowerShell.PSReadLine/Microsoft.PowerShell.PSReadLine.csproj b/src/Microsoft.PowerShell.PSReadLine/Microsoft.PowerShell.PSReadLine.csproj deleted file mode 100644 index 3f1c05057..000000000 --- a/src/Microsoft.PowerShell.PSReadLine/Microsoft.PowerShell.PSReadLine.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - PowerShell Core's Microsoft.PowerShell.PSReadLine project - Microsoft.PowerShell.PSReadLine - - - - - - - diff --git a/src/Microsoft.PowerShell.Security/security/CatalogCommands.cs b/src/Microsoft.PowerShell.Security/security/CatalogCommands.cs index 08051337a..486434688 100644 --- a/src/Microsoft.PowerShell.Security/security/CatalogCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/CatalogCommands.cs @@ -94,7 +94,7 @@ namespace Microsoft.PowerShell.Commands { foreach (PathInfo tempPath in SessionState.Path.GetResolvedPSPathFromPSPath(p)) { - if (ShouldProcess("Including path " + tempPath.ProviderPath, "", "")) + if (ShouldProcess("Including path " + tempPath.ProviderPath, string.Empty, string.Empty)) { paths.Add(tempPath.ProviderPath); } diff --git a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs index 01e2db04f..802f93a84 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs @@ -609,7 +609,7 @@ namespace Microsoft.PowerShell.Commands AddItemToCache(StoreLocation.LocalMachine.ToString(), machine); - AddItemToCache("", s_storeLocations); + AddItemToCache(string.Empty, s_storeLocations); } } } // constructor @@ -2088,7 +2088,7 @@ namespace Microsoft.PowerShell.Commands // // items at paths of depth 3 are certificates. // - string storePath = GetParentPath(path, ""); + string storePath = GetParentPath(path, string.Empty); string[] storePathElements = GetPathElements(storePath); // diff --git a/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs b/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs index b7a3e1cb8..da4a8cc87 100644 --- a/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs @@ -377,7 +377,7 @@ namespace Microsoft.PowerShell.Commands _timestampServer = value; } } - private string _timestampServer = ""; + private string _timestampServer = string.Empty; /// /// Gets or sets the hash algorithm used for signing. diff --git a/src/Microsoft.PowerShell.Security/security/Utils.cs b/src/Microsoft.PowerShell.Security/security/Utils.cs index 2f865bbb7..2dadca16a 100644 --- a/src/Microsoft.PowerShell.Security/security/Utils.cs +++ b/src/Microsoft.PowerShell.Security/security/Utils.cs @@ -53,7 +53,7 @@ namespace Microsoft.PowerShell hostUI.Write(prompt); ss = hostUI.ReadLineAsSecureString(); - hostUI.WriteLine(""); + hostUI.WriteLine(string.Empty); return ss; } diff --git a/src/Microsoft.WSMan.Management/ConfigProvider.cs b/src/Microsoft.WSMan.Management/ConfigProvider.cs index c4d01b9e3..e1b1e026b 100644 --- a/src/Microsoft.WSMan.Management/ConfigProvider.cs +++ b/src/Microsoft.WSMan.Management/ConfigProvider.cs @@ -146,7 +146,7 @@ namespace Microsoft.WSMan.Management // Add the "msh" and "command" namespaces from the MAML schema XmlNamespaceManager nsMgr = new XmlNamespaceManager(document.NameTable); // XPath 1.0 associates empty prefix with "null" namespace; must use non-empty prefix for default namespace. - // This will not work: nsMgr.AddNamespace("", "http://msh"); + // This will not work: nsMgr.AddNamespace(string.Empty, "http://msh"); nsMgr.AddNamespace("msh", "http://msh"); nsMgr.AddNamespace("command", "http://schemas.microsoft.com/maml/dev/command/2004/10"); @@ -901,7 +901,7 @@ namespace Microsoft.WSMan.Management } string whatIfMessage = String.Format(CultureInfo.CurrentUICulture, helper.GetResourceMsgFromResourcetext("SetItemWhatIfAndConfirmText"), path, value); - if (!ShouldProcess(whatIfMessage, "", "")) + if (!ShouldProcess(whatIfMessage, string.Empty, string.Empty)) { return; } @@ -1671,7 +1671,7 @@ namespace Microsoft.WSMan.Management if (path.EndsWith(strPathCheck + WSManStringLiterals.containerResources, StringComparison.OrdinalIgnoreCase)) { throwerror = false; - ResourceArray = RemoveItemfromResourceArray(ResourceArray, ChildName, "", "ResourceDir"); + ResourceArray = RemoveItemfromResourceArray(ResourceArray, ChildName, string.Empty, "ResourceDir"); } if (throwerror) { @@ -1690,7 +1690,7 @@ namespace Microsoft.WSMan.Management if (path.EndsWith(strPathCheck + WSManStringLiterals.containerSecurity, StringComparison.OrdinalIgnoreCase)) { throwerror = false; - SecurityArray = RemoveItemfromResourceArray(SecurityArray, ChildName, "", "SecurityDIR"); + SecurityArray = RemoveItemfromResourceArray(SecurityArray, ChildName, string.Empty, "SecurityDIR"); } } } @@ -1698,7 +1698,7 @@ namespace Microsoft.WSMan.Management { // Remove-Item is called for one of the initialization Parameters. throwerror = false; - InitParamArray = RemoveItemfromResourceArray(InitParamArray, ChildName, "InitParams", ""); + InitParamArray = RemoveItemfromResourceArray(InitParamArray, ChildName, "InitParams", string.Empty); } if (throwerror) { @@ -2244,7 +2244,7 @@ namespace Microsoft.WSMan.Management } if (!String.IsNullOrEmpty(ExtendedTypeName)) { - StringBuilder types = new StringBuilder(""); + StringBuilder types = new StringBuilder(string.Empty); if (mshObject != null) { types.Append(mshObject.ImmediateBaseObject.GetType().FullName); @@ -2438,7 +2438,7 @@ namespace Microsoft.WSMan.Management private string GetRootNodeName(string ResourceURI) { - string tempuri = ""; + string tempuri = string.Empty; if (ResourceURI.Contains("?")) { ResourceURI = ResourceURI.Split(new char[] { '?' }).GetValue(0).ToString(); @@ -2669,7 +2669,7 @@ namespace Microsoft.WSMan.Management { try { - object value = ((IWSManSession)sessionobj).Enumerate(ResourceURI, "", "", 0); + object value = ((IWSManSession)sessionobj).Enumerate(ResourceURI, string.Empty, string.Empty, 0); string strXmlValue = string.Empty; while (!((IWSManEnumerator)value).AtEndOfStream) @@ -2803,13 +2803,13 @@ namespace Microsoft.WSMan.Management { if (ResourceURI.Contains(WSManStringLiterals.containerListener) || ResourceURI.Contains(WSManStringLiterals.containerPlugin) || ResourceURI.Contains(WSManStringLiterals.containerCertMapping)) { - object value = ((IWSManSession)sessionobj).Enumerate(ResourceURI, "", "", 0); + object value = ((IWSManSession)sessionobj).Enumerate(ResourceURI, string.Empty, string.Empty, 0); while (!((IWSManEnumerator)value).AtEndOfStream) { valuexml = valuexml + ((IWSManEnumerator)value).ReadItem(); } - if ((valuexml != "") && !(String.IsNullOrEmpty(valuexml))) + if ((valuexml != string.Empty) && !(String.IsNullOrEmpty(valuexml))) { valuexml = "" + valuexml + ""; } @@ -2992,7 +2992,7 @@ namespace Microsoft.WSMan.Management } if (!String.IsNullOrEmpty(ExtendedTypeName)) { - StringBuilder types = new StringBuilder(""); + StringBuilder types = new StringBuilder(string.Empty); if (mshObject != null) { types.Append(mshObject.ImmediateBaseObject.GetType().FullName); @@ -4020,7 +4020,7 @@ namespace Microsoft.WSMan.Management switch (methodname) { case ProviderMethods.GetChildItems: - PSObject obj = BuildHostLevelPSObjectArrayList(null, "", true); + PSObject obj = BuildHostLevelPSObjectArrayList(null, string.Empty, true); WritePSObjectPropertiesAsWSManElementObjects(obj, WSManStringLiterals.rootpath, null, "ComputerLevel", WsManElementObjectTypes.WSManConfigContainerElement, recurse); break; @@ -5034,7 +5034,7 @@ namespace Microsoft.WSMan.Management private string ConstructResourceXml(PSObject objinputparams, ArrayList resources, ArrayList securities) { - StringBuilder sbvalues = new StringBuilder(""); + StringBuilder sbvalues = new StringBuilder(string.Empty); if (objinputparams == null && resources == null) { return sbvalues.ToString(); @@ -5118,7 +5118,7 @@ namespace Microsoft.WSMan.Management private string ConstructSecurityXml(PSObject objinputparams, ArrayList securities, string strResourceIdentity) { // - StringBuilder sbvalues = new StringBuilder(""); + StringBuilder sbvalues = new StringBuilder(string.Empty); if (objinputparams == null && securities == null) { return sbvalues.ToString(); @@ -5169,7 +5169,7 @@ namespace Microsoft.WSMan.Management // // // - StringBuilder sbvalues = new StringBuilder(""); + StringBuilder sbvalues = new StringBuilder(string.Empty); if (objinputparams == null && initparams == null) { return sbvalues.ToString(); @@ -5216,7 +5216,7 @@ namespace Microsoft.WSMan.Management private string ConstructCapabilityXml(object[] capabilities) { - StringBuilder sbvalues = new StringBuilder(""); + StringBuilder sbvalues = new StringBuilder(string.Empty); foreach (object cap in capabilities) { sbvalues.Append("CreateSession method of IWSMan interface. - /// An original IDL definition of CreateSession method was the following: HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); - // IDL: HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); + /// An original IDL definition of CreateSession method was the following: HRESULT CreateSession ([optional, defaultvalue(string.Empty)] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); + // IDL: HRESULT CreateSession ([optional, defaultvalue(string.Empty)] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); [DispId(1)] #if CORECLR @@ -480,8 +480,8 @@ namespace Microsoft.WSMan.Management #endif /// CreateSession method of IWSManEx interface. - /// An original IDL definition of CreateSession method was the following: HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); - // IDL: HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); + /// An original IDL definition of CreateSession method was the following: HRESULT CreateSession ([optional, defaultvalue(string.Empty)] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); + // IDL: HRESULT CreateSession ([optional, defaultvalue(string.Empty)] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue); [DispId(1)] #if CORECLR @@ -533,8 +533,8 @@ namespace Microsoft.WSMan.Management } /// CreateResourceLocator method of IWSManEx interface. - /// An original IDL definition of CreateResourceLocator method was the following: HRESULT CreateResourceLocator ([optional, defaultvalue("")] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue); - // IDL: HRESULT CreateResourceLocator ([optional, defaultvalue("")] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue); + /// An original IDL definition of CreateResourceLocator method was the following: HRESULT CreateResourceLocator ([optional, defaultvalue(string.Empty)] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue); + // IDL: HRESULT CreateResourceLocator ([optional, defaultvalue(string.Empty)] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue); [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "str")] [DispId(5)] @@ -942,8 +942,8 @@ namespace Microsoft.WSMan.Management String Invoke([MarshalAs(UnmanagedType.BStr)] string actionURI, [In] object resourceUri, [MarshalAs(UnmanagedType.BStr)] string parameters, [In] int flags); /// Enumerate method of IWSManSession interface. - /// An original IDL definition of Enumerate method was the following: HRESULT Enumerate (VARIANT resourceUri, [optional, defaultvalue("")] BSTR filter, [optional, defaultvalue("")] BSTR dialect, [optional, defaultvalue(0)] long flags, [out, retval] IDispatch** ReturnValue); - // IDL: HRESULT Enumerate (VARIANT resourceUri, [optional, defaultvalue("")] BSTR filter, [optional, defaultvalue("")] BSTR dialect, [optional, defaultvalue(0)] long flags, [out, retval] IDispatch** ReturnValue); + /// An original IDL definition of Enumerate method was the following: HRESULT Enumerate (VARIANT resourceUri, [optional, defaultvalue(string.Empty)] BSTR filter, [optional, defaultvalue(string.Empty)] BSTR dialect, [optional, defaultvalue(0)] long flags, [out, retval] IDispatch** ReturnValue); + // IDL: HRESULT Enumerate (VARIANT resourceUri, [optional, defaultvalue(string.Empty)] BSTR filter, [optional, defaultvalue(string.Empty)] BSTR dialect, [optional, defaultvalue(0)] long flags, [out, retval] IDispatch** ReturnValue); [DispId(6)] #if CORECLR diff --git a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs index c7378949b..2e5ff94c7 100644 --- a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs +++ b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs @@ -155,10 +155,10 @@ namespace Microsoft.WSMan.Management { source = sourceAttribute.Value; } - string rxml = ""; + string rxml = string.Empty; if (enabled.Equals("true")) { - string Err_Msg = ""; + string Err_Msg = string.Empty; if (serviceonly) { Err_Msg = WSManResourceLoader.GetResourceString("L_QuickConfigNoServiceChangesNeeded_Message"); @@ -192,7 +192,7 @@ namespace Microsoft.WSMan.Management } string inputXml = resultopxml.SelectSingleNode(xpathUpdate, nsmgr).OuterXml; - if (resultAction.Equals("") || inputXml.Equals("")) + if (resultAction.Equals(string.Empty) || inputXml.Equals(string.Empty)) { ArgumentException e = new ArgumentException(WSManResourceLoader.GetResourceString("L_ERR_Message") + WSManResourceLoader.GetResourceString("L_QuickConfig_MissingUpdateXml_0_ErrorMessage")); ErrorRecord er = new ErrorRecord(e, "InvalidOperation", ErrorCategory.InvalidOperation, null); diff --git a/src/Microsoft.WSMan.Management/WsManHelper.cs b/src/Microsoft.WSMan.Management/WsManHelper.cs index 45e906510..d4c57b3c6 100644 --- a/src/Microsoft.WSMan.Management/WsManHelper.cs +++ b/src/Microsoft.WSMan.Management/WsManHelper.cs @@ -473,7 +473,7 @@ namespace Microsoft.WSMan.Management newnode.Value = "true"; node.Attributes.Append(newnode); //(newnode.Attributes.Item(0).FirstChild ); - node.Value = ""; + node.Value = string.Empty; } else { @@ -1106,7 +1106,7 @@ namespace Microsoft.WSMan.Management { LoadResourceData(); } - string value = ""; + string value = string.Empty; if (ResourceValueCache.ContainsKey(Key.Trim())) { ResourceValueCache.TryGetValue(Key.Trim(), out value); diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index aa9b11912..deaae764f 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -419,7 +419,7 @@ namespace System.Management.Automation /// /// /// The path to the specified system special folder, if that folder physically exists on your computer. - /// Otherwise, an empty string (""). + /// Otherwise, an empty string (string.Empty). /// private static string InternalGetFolderPath(System.Environment.SpecialFolder folder) { diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 36970c762..04c906019 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -2820,17 +2820,17 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal { if (dscProperty.Key) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}key", needComma ? ", " : ""); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}key", needComma ? ", " : string.Empty); needComma = true; } if (dscProperty.Mandatory) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}required", needComma ? ", " : ""); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}required", needComma ? ", " : string.Empty); needComma = true; } if (dscProperty.NotConfigurable) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}read", needComma ? ", " : ""); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}read", needComma ? ", " : string.Empty); needComma = true; } continue; @@ -2841,13 +2841,13 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal { bool valueMapComma = false; StringBuilder sbValues = new StringBuilder(", Values{"); - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}ValueMap{{", needComma ? ", " : ""); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}ValueMap{{", needComma ? ", " : string.Empty); needComma = true; foreach (var value in validateSet.ValidValues) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", valueMapComma ? ", " : "", value); - sbValues.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", valueMapComma ? ", " : "", value); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", valueMapComma ? ", " : string.Empty, value); + sbValues.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", valueMapComma ? ", " : string.Empty, value); valueMapComma = true; } sb.Append("}"); @@ -2865,25 +2865,25 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal if (enumNames != null) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}ValueMap{{", needComma ? ", " : ""); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}ValueMap{{", needComma ? ", " : string.Empty); needComma = false; foreach (var name in enumNames) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", needComma ? ", " : "", name); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", needComma ? ", " : string.Empty, name); needComma = true; } sb.Append("}, Values{"); needComma = false; foreach (var name in enumNames) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", needComma ? ", " : "", name); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}\"{1}\"", needComma ? ", " : string.Empty, name); needComma = true; } sb.Append("}"); } else if (embeddedInstanceType != null) { - sb.AppendFormat(CultureInfo.InvariantCulture, "{0}EmbeddedInstance(\"{1}\")", needComma ? ", " : "", embeddedInstanceType); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}EmbeddedInstance(\"{1}\")", needComma ? ", " : string.Empty, embeddedInstanceType); } sb.Append("]"); return sb.ToString(); diff --git a/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs b/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs index 047cfa569..0f2131010 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs @@ -445,7 +445,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format private void ProcessFormatStart(FormatMessagesContextManager.OutputContext c) { // we just add an empty line to the display - this.LineOutput.WriteLine(""); + this.LineOutput.WriteLine(string.Empty); } /// @@ -457,7 +457,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { //Console.WriteLine("ProcessFormatEnd"); // we just add an empty line to the display - this.LineOutput.WriteLine(""); + this.LineOutput.WriteLine(string.Empty); } /// @@ -471,13 +471,13 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (goc.Data.groupingEntry != null) { - _lo.WriteLine(""); + _lo.WriteLine(string.Empty); ComplexWriter writer = new ComplexWriter(); writer.Initialize(_lo, _lo.ColumnNumber); writer.WriteObject(goc.Data.groupingEntry.formatValueList); - this.LineOutput.WriteLine(""); + this.LineOutput.WriteLine(string.Empty); } goc.GroupStart(); } @@ -493,7 +493,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format GroupOutputContext goc = (GroupOutputContext)c; goc.GroupEnd(); - this.LineOutput.WriteLine(""); + this.LineOutput.WriteLine(string.Empty); } /// @@ -573,14 +573,14 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { ListWriter listWriter = new ListWriter(); - _lo.WriteLine(""); + _lo.WriteLine(string.Empty); string[] properties = ListOutputContext.GetProperties(lve); listWriter.Initialize(properties, _lo.ColumnNumber, _lo.DisplayCells); string[] values = ListOutputContext.GetValues(lve); listWriter.WriteProperties(values, _lo); - _lo.WriteLine(""); + _lo.WriteLine(string.Empty); return; } @@ -1021,7 +1021,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - values[k] = ""; + values[k] = string.Empty; alignment[k] = TextAlignment.Left; // hard coded default } } @@ -1099,7 +1099,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// internal override void GroupStart() { - this.InnerCommand._lo.WriteLine(""); + this.InnerCommand._lo.WriteLine(string.Empty); } /// @@ -1112,7 +1112,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format InternalInitialize(lve); string[] values = GetValues(lve); _listWriter.WriteProperties(values, this.InnerCommand._lo); - this.InnerCommand._lo.WriteLine(""); + this.InnerCommand._lo.WriteLine(string.Empty); } /// @@ -1187,7 +1187,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// internal override void GroupStart() { - this.InnerCommand._lo.WriteLine(""); + this.InnerCommand._lo.WriteLine(string.Empty); } /// @@ -1235,7 +1235,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (k < _buffer.CurrentCount) values[k] = _buffer[k]; else - values[k] = ""; + values[k] = string.Empty; } this.Writer.GenerateRow(values, this.InnerCommand._lo, false, null, InnerCommand._lo.DisplayCells); _buffer.Reset(); diff --git a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs index 17b06f7f6..ad8feb54c 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs @@ -701,7 +701,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { if (string.IsNullOrEmpty(s)) { - return ""; + return string.Empty; } int lineBreak = s.IndexOfAny(s_lineBreakChars); diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs index b22c84d09..49feabe13 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs @@ -382,7 +382,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { return FormatShape.Complex.ToString(); } - return ""; + return string.Empty; } /// diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator.cs index b6e0e0936..969f46837 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator.cs @@ -429,7 +429,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - fpf.propertyValue = ""; + fpf.propertyValue = string.Empty; } return fpf; } diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Complex.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Complex.cs index 2b0e7a961..b7d537347 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Complex.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Complex.cs @@ -279,7 +279,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // on with formatting if (val == null) { - val = ""; + val = string.Empty; } FieldFormattingDirective fieldFormattingDirective = null; StringFormatError formatErrorObject = null; @@ -550,7 +550,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - val = ""; + val = string.Empty; } } else diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs index bc502f3a4..ef0c98390 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs @@ -201,7 +201,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - ci.label = ""; + ci.label = string.Empty; } } diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs index 750f4a3b0..9a62ce231 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs @@ -82,7 +82,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } } - return ""; + return string.Empty; } internal void Initialize(TerminatingErrorContext errorContext, diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatXMLWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatXMLWriter.cs index fa481d673..bd1d82f92 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatXMLWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatXMLWriter.cs @@ -127,7 +127,7 @@ namespace Microsoft.PowerShell.Commands } if (formatdef.Control.OutOfBand) { - _writer.WriteElementString("OutOfBand", ""); + _writer.WriteElementString("OutOfBand", string.Empty); } formatdef.Control.WriteToXml(this); @@ -143,11 +143,11 @@ namespace Microsoft.PowerShell.Commands _writer.WriteStartElement("TableControl"); if (tableControl.AutoSize) { - _writer.WriteElementString("AutoSize", ""); + _writer.WriteElementString("AutoSize", string.Empty); } if (tableControl.HideTableHeaders) { - _writer.WriteElementString("HideTableHeaders", ""); + _writer.WriteElementString("HideTableHeaders", string.Empty); } _writer.WriteStartElement("TableHeaders"); @@ -301,7 +301,7 @@ namespace Microsoft.PowerShell.Commands if (wideControl.AutoSize) { - _writer.WriteElementString("AutoSize", ""); + _writer.WriteElementString("AutoSize", string.Empty); } _writer.WriteStartElement("WideEntries"); @@ -368,7 +368,7 @@ namespace Microsoft.PowerShell.Commands { for (int i = 0; i < newline.Count; i++) { - _writer.WriteElementString("NewLine", ""); + _writer.WriteElementString("NewLine", string.Empty); } return; } @@ -386,7 +386,7 @@ namespace Microsoft.PowerShell.Commands _writer.WriteStartElement("ExpressionBinding"); if (expr.EnumerateCollection) { - _writer.WriteElementString("EnumerateCollection", ""); + _writer.WriteElementString("EnumerateCollection", string.Empty); } if (expr.ItemSelectionCondition != null) diff --git a/src/System.Management.Automation/FormatAndOutput/common/ListWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/ListWriter.cs index 4f5753e73..4d3cc3fe5 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/ListWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/ListWriter.cs @@ -120,7 +120,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // we have nothing, but we have to create an empty array valuesToPrint = new string[_propertyLabels.Length]; for (int k = 0; k < _propertyLabels.Length; k++) - valuesToPrint[k] = ""; + valuesToPrint[k] = string.Empty; } else if (values.Length < _propertyLabels.Length) { @@ -131,7 +131,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (k < values.Length) valuesToPrint[k] = values[k]; else - valuesToPrint[k] = ""; + valuesToPrint[k] = string.Empty; } } else if (values.Length > _propertyLabels.Length) @@ -165,7 +165,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format private void WriteProperty(int k, string propertyValue, LineOutput lo) { if (propertyValue == null) - propertyValue = ""; + propertyValue = string.Empty; // make sure we honor embedded newlines string[] lines = StringManipulationHelper.SplitLines(propertyValue); @@ -201,7 +201,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format private void WriteSingleLineHelper(string prependString, string line, LineOutput lo) { if (line == null) - line = ""; + line = string.Empty; // compute the width of the field for the value string (in screen cells) int fieldCellCount = _columnWidth - _propertyLabelsDisplayLength; diff --git a/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs index 1a6908746..6886eb761 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs @@ -156,7 +156,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // the column can be hidden if (_si.columnInfo[k].width <= 0) { - breakLine[k] = ""; + breakLine[k] = string.Empty; continue; } // the title can be larger than the width @@ -333,7 +333,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // if the column is beyond the last column with content, just use empty string if (col > lastColWithContent[row]) { - scArray[col].Add(""); + scArray[col].Add(string.Empty); } else { diff --git a/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs b/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs index fdc09b817..c4f885112 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshObjectUtil.cs @@ -280,7 +280,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal static string SmartToString(PSObject so, MshExpressionFactory expressionFactory, int enumerationLimit, StringFormatError formatErrorObject) { if (so == null) - return ""; + return string.Empty; try { @@ -367,11 +367,11 @@ namespace Microsoft.PowerShell.Commands.Internal.Format formatErrorObject.sourceObject = so; formatErrorObject.exception = e; } - return ""; + return string.Empty; } } - private static readonly PSObject s_emptyPSObject = new PSObject(""); + private static readonly PSObject s_emptyPSObject = new PSObject(string.Empty); internal static PSObject AsPSObject(object obj) { @@ -420,7 +420,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format formatErrorObject.sourceObject = so; formatErrorObject.exception = e; formatErrorObject.formatString = directive.formatString; - return ""; + return string.Empty; } } } @@ -545,13 +545,13 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (resList.Count == 0) { - return ""; + return string.Empty; } result = resList[0]; if (result.Exception != null) { - return ""; + return string.Empty; } return PSObjectHelper.FormatField(directive, result.Result, enumerationLimit, formatErrorObject, expressionFactory); } diff --git a/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs b/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs index ab4f378aa..376c05d15 100644 --- a/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs +++ b/src/System.Management.Automation/cimSupport/cmdletization/xml/CoreCLR/cmdlets-over-objects.xmlSerializer.autogen.cs @@ -1421,11 +1421,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations0, ref readerCount0); @@ -1560,11 +1560,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations2, ref readerCount2); @@ -1617,7 +1617,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml string tmp = null; if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else if (Reader.NodeType == System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA || @@ -1629,7 +1629,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations3, ref readerCount3); @@ -1962,11 +1962,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations7, ref readerCount7); @@ -2023,11 +2023,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations8, ref readerCount8); @@ -2084,11 +2084,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations9, ref readerCount9); @@ -2145,11 +2145,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations10, ref readerCount10); @@ -2675,11 +2675,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations20, ref readerCount20); @@ -2810,7 +2810,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml string tmp = null; if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else if (Reader.NodeType == System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA || @@ -2822,7 +2822,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations22, ref readerCount22); @@ -3386,11 +3386,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations30, ref readerCount30); @@ -5764,11 +5764,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations63, ref readerCount63); @@ -5825,11 +5825,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations64, ref readerCount64); @@ -5886,11 +5886,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations65, ref readerCount65); @@ -6228,7 +6228,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml _id1_PowerShellMetadata = Reader.NameTable.Add(@"PowerShellMetadata"); _id98_HelpUri = Reader.NameTable.Add(@"HelpUri"); _id91_DefaultValue = Reader.NameTable.Add(@"DefaultValue"); - _id4_Item = Reader.NameTable.Add(@""); + _id4_Item = Reader.NameTable.Add(string.Empty); _id32_Item = Reader.NameTable.Add(@"CommonMethodMetadataReturnValue"); _id43_EnumName = Reader.NameTable.Add(@"EnumName"); _id122_Enums = Reader.NameTable.Add(@"Enums"); diff --git a/src/System.Management.Automation/cimSupport/cmdletization/xml/cmdlets-over-objects.xmlSerializer.autogen.cs b/src/System.Management.Automation/cimSupport/cmdletization/xml/cmdlets-over-objects.xmlSerializer.autogen.cs index 59efd97fa..7069d88aa 100644 --- a/src/System.Management.Automation/cimSupport/cmdletization/xml/cmdlets-over-objects.xmlSerializer.autogen.cs +++ b/src/System.Management.Automation/cimSupport/cmdletization/xml/cmdlets-over-objects.xmlSerializer.autogen.cs @@ -35,7 +35,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"ClassMetadata", @""); + WriteNullTagLiteral(@"ClassMetadata", string.Empty); return; } TopLevelElement(); @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"ClassMetadataInstanceCmdlets", @""); + WriteNullTagLiteral(@"ClassMetadataInstanceCmdlets", string.Empty); return; } TopLevelElement(); @@ -59,7 +59,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"GetCmdletParameters", @""); + WriteNullTagLiteral(@"GetCmdletParameters", string.Empty); return; } TopLevelElement(); @@ -71,7 +71,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"PropertyMetadata", @""); + WriteNullTagLiteral(@"PropertyMetadata", string.Empty); return; } TopLevelElement(); @@ -83,7 +83,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"TypeMetadata", @""); + WriteNullTagLiteral(@"TypeMetadata", string.Empty); return; } TopLevelElement(); @@ -95,7 +95,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"Association", @""); + WriteNullTagLiteral(@"Association", string.Empty); return; } TopLevelElement(); @@ -107,7 +107,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"AssociationAssociatedInstance", @""); + WriteNullTagLiteral(@"AssociationAssociatedInstance", string.Empty); return; } TopLevelElement(); @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadata", @""); + WriteNullTagLiteral(@"CmdletParameterMetadata", string.Empty); return; } TopLevelElement(); @@ -131,7 +131,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataForGetCmdletParameter", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataForGetCmdletParameter", string.Empty); return; } TopLevelElement(); @@ -143,7 +143,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataForGetCmdletFilteringParameter", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataForGetCmdletFilteringParameter", string.Empty); return; } TopLevelElement(); @@ -155,7 +155,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataValidateCount", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataValidateCount", string.Empty); return; } TopLevelElement(); @@ -167,7 +167,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataValidateLength", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataValidateLength", string.Empty); return; } TopLevelElement(); @@ -179,7 +179,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataValidateRange", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataValidateRange", string.Empty); return; } TopLevelElement(); @@ -191,7 +191,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"ObsoleteAttributeMetadata", @""); + WriteNullTagLiteral(@"ObsoleteAttributeMetadata", string.Empty); return; } TopLevelElement(); @@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataForInstanceMethodParameter", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataForInstanceMethodParameter", string.Empty); return; } TopLevelElement(); @@ -215,7 +215,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletParameterMetadataForStaticMethodParameter", @""); + WriteNullTagLiteral(@"CmdletParameterMetadataForStaticMethodParameter", string.Empty); return; } TopLevelElement(); @@ -227,7 +227,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"QueryOption", @""); + WriteNullTagLiteral(@"QueryOption", string.Empty); return; } TopLevelElement(); @@ -239,7 +239,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"GetCmdletMetadata", @""); + WriteNullTagLiteral(@"GetCmdletMetadata", string.Empty); return; } TopLevelElement(); @@ -251,7 +251,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CommonCmdletMetadata", @""); + WriteNullTagLiteral(@"CommonCmdletMetadata", string.Empty); return; } TopLevelElement(); @@ -263,7 +263,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteEmptyTag(@"ConfirmImpact", @""); + WriteEmptyTag(@"ConfirmImpact", string.Empty); return; } WriteElementString(@"ConfirmImpact", @"", Write20_ConfirmImpact(((global::Microsoft.PowerShell.Cmdletization.Xml.ConfirmImpact)o))); @@ -274,7 +274,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"StaticCmdletMetadata", @""); + WriteNullTagLiteral(@"StaticCmdletMetadata", string.Empty); return; } TopLevelElement(); @@ -286,7 +286,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"StaticCmdletMetadataCmdletMetadata", @""); + WriteNullTagLiteral(@"StaticCmdletMetadataCmdletMetadata", string.Empty); return; } TopLevelElement(); @@ -298,7 +298,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CommonMethodMetadata", @""); + WriteNullTagLiteral(@"CommonMethodMetadata", string.Empty); return; } TopLevelElement(); @@ -310,7 +310,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"StaticMethodMetadata", @""); + WriteNullTagLiteral(@"StaticMethodMetadata", string.Empty); return; } TopLevelElement(); @@ -322,7 +322,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CommonMethodParameterMetadata", @""); + WriteNullTagLiteral(@"CommonMethodParameterMetadata", string.Empty); return; } TopLevelElement(); @@ -334,7 +334,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"StaticMethodParameterMetadata", @""); + WriteNullTagLiteral(@"StaticMethodParameterMetadata", string.Empty); return; } TopLevelElement(); @@ -346,7 +346,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CmdletOutputMetadata", @""); + WriteNullTagLiteral(@"CmdletOutputMetadata", string.Empty); return; } TopLevelElement(); @@ -358,7 +358,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"InstanceMethodParameterMetadata", @""); + WriteNullTagLiteral(@"InstanceMethodParameterMetadata", string.Empty); return; } TopLevelElement(); @@ -370,7 +370,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"CommonMethodMetadataReturnValue", @""); + WriteNullTagLiteral(@"CommonMethodMetadataReturnValue", string.Empty); return; } TopLevelElement(); @@ -382,7 +382,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"InstanceMethodMetadata", @""); + WriteNullTagLiteral(@"InstanceMethodMetadata", string.Empty); return; } TopLevelElement(); @@ -394,7 +394,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"InstanceCmdletMetadata", @""); + WriteNullTagLiteral(@"InstanceCmdletMetadata", string.Empty); return; } TopLevelElement(); @@ -406,7 +406,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"PropertyQuery", @""); + WriteNullTagLiteral(@"PropertyQuery", string.Empty); return; } TopLevelElement(); @@ -418,7 +418,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"WildcardablePropertyQuery", @""); + WriteNullTagLiteral(@"WildcardablePropertyQuery", string.Empty); return; } TopLevelElement(); @@ -430,7 +430,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteEmptyTag(@"ItemsChoiceType", @""); + WriteEmptyTag(@"ItemsChoiceType", string.Empty); return; } WriteElementString(@"ItemsChoiceType", @"", Write3_ItemsChoiceType(((global::Microsoft.PowerShell.Cmdletization.Xml.ItemsChoiceType)o))); @@ -441,7 +441,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"ClassMetadataData", @""); + WriteNullTagLiteral(@"ClassMetadataData", string.Empty); return; } TopLevelElement(); @@ -453,7 +453,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"EnumMetadataEnum", @""); + WriteNullTagLiteral(@"EnumMetadataEnum", string.Empty); return; } TopLevelElement(); @@ -465,7 +465,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml WriteStartDocument(); if (o == null) { - WriteNullTagLiteral(@"EnumMetadataEnumValue", @""); + WriteNullTagLiteral(@"EnumMetadataEnumValue", string.Empty); return; } TopLevelElement(); @@ -665,7 +665,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -689,7 +689,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@CmdletParameterSets; if (a != null) { - Writer.WriteStartAttribute(null, @"CmdletParameterSets", @""); + Writer.WriteStartAttribute(null, @"CmdletParameterSets", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -1428,7 +1428,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -1557,7 +1557,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -1650,7 +1650,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -1755,7 +1755,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -1779,7 +1779,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@CmdletParameterSets; if (a != null) { - Writer.WriteStartAttribute(null, @"CmdletParameterSets", @""); + Writer.WriteStartAttribute(null, @"CmdletParameterSets", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -2018,7 +2018,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -2143,7 +2143,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -2197,7 +2197,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml global::System.String[] a = (global::System.String[])o.@Aliases; if (a != null) { - Writer.WriteStartAttribute(null, @"Aliases", @""); + Writer.WriteStartAttribute(null, @"Aliases", string.Empty); for (int i = 0; i < a.Length; i++) { global::System.String ai = (global::System.String)a[i]; @@ -3558,11 +3558,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations0, ref readerCount0); @@ -3697,11 +3697,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations2, ref readerCount2); @@ -3754,7 +3754,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml string tmp = null; if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else if (Reader.NodeType == System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA || @@ -3766,7 +3766,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations3, ref readerCount3); @@ -4099,11 +4099,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations7, ref readerCount7); @@ -4160,11 +4160,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations8, ref readerCount8); @@ -4221,11 +4221,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations9, ref readerCount9); @@ -4282,11 +4282,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations10, ref readerCount10); @@ -4812,11 +4812,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations20, ref readerCount20); @@ -4947,7 +4947,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml string tmp = null; if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else if (Reader.NodeType == System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA || @@ -4959,7 +4959,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations22, ref readerCount22); @@ -5523,11 +5523,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations30, ref readerCount30); @@ -7901,11 +7901,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations63, ref readerCount63); @@ -7962,11 +7962,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations64, ref readerCount64); @@ -8023,11 +8023,11 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } else { - UnknownNode((object)o, @""); + UnknownNode((object)o, string.Empty); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations65, ref readerCount65); @@ -8369,7 +8369,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml _id1_PowerShellMetadata = Reader.NameTable.Add(@"PowerShellMetadata"); _id98_HelpUri = Reader.NameTable.Add(@"HelpUri"); _id91_DefaultValue = Reader.NameTable.Add(@"DefaultValue"); - _id4_Item = Reader.NameTable.Add(@""); + _id4_Item = Reader.NameTable.Add(string.Empty); _id32_Item = Reader.NameTable.Add(@"CommonMethodMetadataReturnValue"); _id43_EnumName = Reader.NameTable.Add(@"EnumName"); _id122_Enums = Reader.NameTable.Add(@"Enums"); @@ -8493,7 +8493,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"ClassMetadata", @""); + return xmlReader.IsStartElement(@"ClassMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8512,7 +8512,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"ClassMetadataInstanceCmdlets", @""); + return xmlReader.IsStartElement(@"ClassMetadataInstanceCmdlets", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8531,7 +8531,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"GetCmdletParameters", @""); + return xmlReader.IsStartElement(@"GetCmdletParameters", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8550,7 +8550,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"PropertyMetadata", @""); + return xmlReader.IsStartElement(@"PropertyMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8569,7 +8569,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"TypeMetadata", @""); + return xmlReader.IsStartElement(@"TypeMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8588,7 +8588,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"Association", @""); + return xmlReader.IsStartElement(@"Association", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8607,7 +8607,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"AssociationAssociatedInstance", @""); + return xmlReader.IsStartElement(@"AssociationAssociatedInstance", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8626,7 +8626,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadata", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8645,7 +8645,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataForGetCmdletParameter", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataForGetCmdletParameter", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8664,7 +8664,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataForGetCmdletFilteringParameter", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataForGetCmdletFilteringParameter", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8683,7 +8683,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataValidateCount", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataValidateCount", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8702,7 +8702,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataValidateLength", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataValidateLength", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8721,7 +8721,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataValidateRange", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataValidateRange", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8740,7 +8740,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"ObsoleteAttributeMetadata", @""); + return xmlReader.IsStartElement(@"ObsoleteAttributeMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8759,7 +8759,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataForInstanceMethodParameter", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataForInstanceMethodParameter", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8778,7 +8778,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletParameterMetadataForStaticMethodParameter", @""); + return xmlReader.IsStartElement(@"CmdletParameterMetadataForStaticMethodParameter", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8797,7 +8797,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"QueryOption", @""); + return xmlReader.IsStartElement(@"QueryOption", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8816,7 +8816,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"GetCmdletMetadata", @""); + return xmlReader.IsStartElement(@"GetCmdletMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8835,7 +8835,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CommonCmdletMetadata", @""); + return xmlReader.IsStartElement(@"CommonCmdletMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8854,7 +8854,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"ConfirmImpact", @""); + return xmlReader.IsStartElement(@"ConfirmImpact", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8873,7 +8873,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"StaticCmdletMetadata", @""); + return xmlReader.IsStartElement(@"StaticCmdletMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8892,7 +8892,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"StaticCmdletMetadataCmdletMetadata", @""); + return xmlReader.IsStartElement(@"StaticCmdletMetadataCmdletMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8911,7 +8911,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CommonMethodMetadata", @""); + return xmlReader.IsStartElement(@"CommonMethodMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8930,7 +8930,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"StaticMethodMetadata", @""); + return xmlReader.IsStartElement(@"StaticMethodMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8949,7 +8949,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CommonMethodParameterMetadata", @""); + return xmlReader.IsStartElement(@"CommonMethodParameterMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8968,7 +8968,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"StaticMethodParameterMetadata", @""); + return xmlReader.IsStartElement(@"StaticMethodParameterMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -8987,7 +8987,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CmdletOutputMetadata", @""); + return xmlReader.IsStartElement(@"CmdletOutputMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9006,7 +9006,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"InstanceMethodParameterMetadata", @""); + return xmlReader.IsStartElement(@"InstanceMethodParameterMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9025,7 +9025,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"CommonMethodMetadataReturnValue", @""); + return xmlReader.IsStartElement(@"CommonMethodMetadataReturnValue", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9044,7 +9044,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"InstanceMethodMetadata", @""); + return xmlReader.IsStartElement(@"InstanceMethodMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9063,7 +9063,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"InstanceCmdletMetadata", @""); + return xmlReader.IsStartElement(@"InstanceCmdletMetadata", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9082,7 +9082,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"PropertyQuery", @""); + return xmlReader.IsStartElement(@"PropertyQuery", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9101,7 +9101,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"WildcardablePropertyQuery", @""); + return xmlReader.IsStartElement(@"WildcardablePropertyQuery", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9120,7 +9120,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"ItemsChoiceType", @""); + return xmlReader.IsStartElement(@"ItemsChoiceType", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9139,7 +9139,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"ClassMetadataData", @""); + return xmlReader.IsStartElement(@"ClassMetadataData", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9158,7 +9158,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"EnumMetadataEnum", @""); + return xmlReader.IsStartElement(@"EnumMetadataEnum", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) @@ -9177,7 +9177,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml { public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { - return xmlReader.IsStartElement(@"EnumMetadataEnumValue", @""); + return xmlReader.IsStartElement(@"EnumMetadataEnumValue", string.Empty); } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) diff --git a/src/System.Management.Automation/engine/AutomationEngine.cs b/src/System.Management.Automation/engine/AutomationEngine.cs index 58e490759..79618b14a 100644 --- a/src/System.Management.Automation/engine/AutomationEngine.cs +++ b/src/System.Management.Automation/engine/AutomationEngine.cs @@ -55,7 +55,7 @@ namespace System.Management.Automation var ast = Parser.ScanString(s); // ExpandString is assumed to invoke code, so passing 'IsTrustedInput' - return Compiler.GetExpressionValue(ast, true, Context, Context.EngineSessionState) as string ?? ""; + return Compiler.GetExpressionValue(ast, true, Context, Context.EngineSessionState) as string ?? string.Empty; } /// diff --git a/src/System.Management.Automation/engine/COM/ComUtil.cs b/src/System.Management.Automation/engine/COM/ComUtil.cs index 070c92e73..3e79b7ac8 100644 --- a/src/System.Management.Automation/engine/COM/ComUtil.cs +++ b/src/System.Management.Automation/engine/COM/ComUtil.cs @@ -234,7 +234,7 @@ namespace System.Management.Automation return "object[]"; case VarEnum.VT_EMPTY: - return ""; + return string.Empty; default: return "Unknown!"; diff --git a/src/System.Management.Automation/engine/CmdletInfo.cs b/src/System.Management.Automation/engine/CmdletInfo.cs index 8cba81f5e..d45f715ec 100644 --- a/src/System.Management.Automation/engine/CmdletInfo.cs +++ b/src/System.Management.Automation/engine/CmdletInfo.cs @@ -491,8 +491,8 @@ namespace System.Management.Automation // Handle the case in one or both of the properties might not be defined. PSPropertyInfo nameProperty = psObject.Properties["Name"]; PSPropertyInfo psSnapInProperty = psObject.Properties["PSSnapIn"]; - string nameString = nameProperty == null ? "" : (string)nameProperty.Value; - string psSnapInString = psSnapInProperty == null ? "" : (string)psSnapInProperty.Value; + string nameString = nameProperty == null ? string.Empty : (string)nameProperty.Value; + string psSnapInString = psSnapInProperty == null ? string.Empty : (string)psSnapInProperty.Value; return GetFullName(psSnapInString, nameString); } } diff --git a/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs b/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs index 6bbe838fb..2c3c9927d 100644 --- a/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs +++ b/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs @@ -237,7 +237,7 @@ namespace System.Management.Automation.ComInterop return; } - String typeNames = ""; + String typeNames = string.Empty; for (int i = 0; i < compatibleComTypes.Count; i++) { string typeName = s_comToManagedPrimitiveTypes[compatibleComTypes[i]].Name; diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs index e5f44a703..4f8debce7 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs @@ -513,7 +513,7 @@ namespace System.Management.Automation // Handle operator completion: 55 - || "string" - || (Get-Something) - if (CompleteOperator(tokenAtCursor, lastAst)) { - result = CompletionCompleters.CompleteOperator(""); + result = CompletionCompleters.CompleteOperator(string.Empty); break; } @@ -1394,7 +1394,7 @@ namespace System.Management.Automation { if (strConst.Value.Equals("$", StringComparison.Ordinal)) { - completionContext.WordToComplete = ""; + completionContext.WordToComplete = string.Empty; return CompletionCompleters.CompleteVariable(completionContext); } else diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index 1ae30cf91..2fa8fbc68 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -2695,7 +2695,7 @@ namespace System.Management.Automation CompletionContext context) { string containerNamespace = "root"; - string prefixOfChildNamespace = ""; + string prefixOfChildNamespace = string.Empty; if (!string.IsNullOrEmpty(context.WordToComplete)) { int lastSlashOrBackslash = context.WordToComplete.LastIndexOfAny(Utils.Separators.Directory); @@ -3738,8 +3738,8 @@ namespace System.Management.Automation { var wordToComplete = context.WordToComplete; var isQuoted = wordToComplete.Length > 0 && (wordToComplete[0].IsSingleQuote() || wordToComplete[0].IsDoubleQuote()); - string prefix = ""; - string suffix = ""; + string prefix = string.Empty; + string suffix = string.Empty; if (isQuoted) { prefix = suffix = wordToComplete.Substring(0, 1); @@ -3781,7 +3781,7 @@ namespace System.Management.Automation // if we only replace the minimum. context.ReplacementIndex = typeNameToComplete.Extent.StartOffset + context.TokenAtCursor.Extent.StartOffset + 1; context.ReplacementLength = wordToComplete.Length; - prefix = suffix = ""; + prefix = suffix = string.Empty; } else { @@ -4574,7 +4574,7 @@ namespace System.Management.Automation if (colon == -1) { pattern = "variable:" + wordToComplete + "*"; - provider = ""; + provider = string.Empty; } else { @@ -5165,8 +5165,8 @@ namespace System.Management.Automation { memberName = propertyInfo.Name; getToolTip = () => ToStringCodeMethods.Type(propertyInfo.PropertyType) + " " + memberName - + " { " + (propertyInfo.GetGetMethod() != null ? "get; " : "") - + (propertyInfo.GetSetMethod() != null ? "set; " : "") + "}"; + + " { " + (propertyInfo.GetGetMethod() != null ? "get; " : string.Empty) + + (propertyInfo.GetSetMethod() != null ? "set; " : string.Empty) + "}"; } var fieldInfo = member as FieldInfo; if (fieldInfo != null) @@ -5479,7 +5479,7 @@ namespace System.Management.Automation if (typeof(ValueType).IsAssignableFrom(Type)) return "Struct "; - return ""; // what other interesting types are there? + return string.Empty; // what other interesting types are there? } internal override CompletionResult GetCompletionResult(string keyMatched, string prefix, string suffix) diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index 1b661569a..6c1134332 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -749,7 +749,7 @@ namespace System.Management.Automation if (scriptblock.UsesCmdletBinding) { - FunctionInfo fi = new FunctionInfo("", scriptblock, context); + FunctionInfo fi = new FunctionInfo(string.Empty, scriptblock, context); return GetScriptAsCmdletProcessor(fi, context, useNewScope, false, sessionState); } diff --git a/src/System.Management.Automation/engine/CommandInfo.cs b/src/System.Management.Automation/engine/CommandInfo.cs index d07489055..2c4cd08eb 100644 --- a/src/System.Management.Automation/engine/CommandInfo.cs +++ b/src/System.Management.Automation/engine/CommandInfo.cs @@ -648,7 +648,7 @@ namespace System.Management.Automation /// /// The prefix that was used when importing this command /// - internal string Prefix { get; set; } = ""; + internal string Prefix { get; set; } = string.Empty; /// /// Create a copy of commandInfo for GetCommandCommand so that we can generate parameter diff --git a/src/System.Management.Automation/engine/CommandMetadata.cs b/src/System.Management.Automation/engine/CommandMetadata.cs index 29a0602ab..b1990f530 100644 --- a/src/System.Management.Automation/engine/CommandMetadata.cs +++ b/src/System.Management.Automation/engine/CommandMetadata.cs @@ -898,8 +898,8 @@ end internal string GetDecl() { - string result = ""; - string separator = ""; + string result = string.Empty; + string separator = string.Empty; if (_wrappedAnyCmdlet) { StringBuilder decl = new StringBuilder("[CmdletBinding("); @@ -997,7 +997,7 @@ end return parameters.ToString(); } - return ""; + return string.Empty; } internal string GetBeginBlock() @@ -1016,7 +1016,7 @@ end // be subject to the runspace restrictions if (_wrappedCommandType == CommandTypes.Function) { - commandOrigin = ""; + commandOrigin = string.Empty; } if (_wrappedAnyCmdlet) diff --git a/src/System.Management.Automation/engine/Credential.cs b/src/System.Management.Automation/engine/Credential.cs index be9d5fc5e..4906a4ef8 100644 --- a/src/System.Management.Automation/engine/Credential.cs +++ b/src/System.Management.Automation/engine/Credential.cs @@ -405,7 +405,7 @@ namespace System.Management.Automation else { user = input; - domain = ""; + domain = string.Empty; } } } diff --git a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs index c3e849cb4..d84f1cc8f 100644 --- a/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs +++ b/src/System.Management.Automation/engine/DataStoreAdapterProvider.cs @@ -29,7 +29,7 @@ namespace System.Management.Automation /// /// Gets the help file path for the provider. /// - public string HelpFile { get; } = ""; + public string HelpFile { get; } = string.Empty; /// /// The instance of session state the provider belongs to. @@ -418,8 +418,8 @@ namespace System.Management.Automation new PSDriveInfo( this.FullName, this, - "", - "", + string.Empty, + string.Empty, null); _hiddenDrive.Hidden = true; diff --git a/src/System.Management.Automation/engine/ErrorPackage.cs b/src/System.Management.Automation/engine/ErrorPackage.cs index b108a459c..8c975fb39 100644 --- a/src/System.Management.Automation/engine/ErrorPackage.cs +++ b/src/System.Management.Automation/engine/ErrorPackage.cs @@ -254,7 +254,7 @@ namespace System.Management.Automation { return _errorRecord.InvocationInfo.MyCommand.Name; } - return ""; + return string.Empty; } set { @@ -283,7 +283,7 @@ namespace System.Management.Automation _reasonIsExceptionType = true; return _errorRecord.Exception.GetType().Name; } - return ""; + return string.Empty; } set { @@ -323,7 +323,7 @@ namespace System.Management.Automation return ErrorRecord.NotNull(targetInString); } - return ""; + return string.Empty; } set { @@ -351,7 +351,7 @@ namespace System.Management.Automation { return _errorRecord.TargetObject.GetType().Name; } - return ""; + return string.Empty; } set { @@ -751,7 +751,7 @@ namespace System.Management.Automation { get { return ErrorRecord.NotNull(_message); } } - private string _message = ""; + private string _message = string.Empty; /// /// Text describing the recommended action in the event that this error @@ -771,7 +771,7 @@ namespace System.Management.Automation _recommendedAction = value; } } - private string _recommendedAction = ""; + private string _recommendedAction = string.Empty; #endregion Public Properties #region Internal Properties @@ -810,7 +810,7 @@ namespace System.Management.Automation if (String.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); - string template = ""; + string template = string.Empty; try { @@ -819,12 +819,12 @@ namespace System.Management.Automation catch (MissingManifestResourceException e) { _textLookupError = e; - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } catch (ArgumentException e) { _textLookupError = e; - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } return BuildMessage(template, baseName, resourceId, args); } // BuildMessage @@ -843,7 +843,7 @@ namespace System.Management.Automation if (String.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); - string template = ""; + string template = string.Empty; try { @@ -852,12 +852,12 @@ namespace System.Management.Automation catch (MissingManifestResourceException e) { _textLookupError = e; - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } catch (ArgumentException e) { _textLookupError = e; - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } return BuildMessage(template, baseName, resourceId, args); } // BuildMessage @@ -876,7 +876,7 @@ namespace System.Management.Automation if (String.IsNullOrEmpty(resourceId)) throw PSTraceSource.NewArgumentNullException("resourceId"); - string template = ""; + string template = string.Empty; ResourceManager manager = ResourceManagerCache.GetResourceManager( @@ -890,7 +890,7 @@ namespace System.Management.Automation catch (MissingManifestResourceException e) { _textLookupError = e; - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } return BuildMessage(template, baseName, resourceId, args); } // BuildMessage @@ -906,7 +906,7 @@ namespace System.Management.Automation ErrorPackage.ErrorDetailsEmptyTemplate, baseName, resourceId); - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } try @@ -919,7 +919,7 @@ namespace System.Management.Automation catch (FormatException e) { _textLookupError = e; - return ""; // fallback to Exception.Message + return string.Empty; // fallback to Exception.Message } } // BuildMessage #endregion Private @@ -990,7 +990,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("exception"); if (errorId == null) - errorId = ""; + errorId = string.Empty; // targetObject may be null @@ -1492,7 +1492,7 @@ namespace System.Management.Automation string delimiter = (String.IsNullOrEmpty(typeName) || String.IsNullOrEmpty(_errorId)) - ? "" : ","; + ? string.Empty : ","; return NotNull(_errorId) + delimiter + NotNull(typeName); } } @@ -1652,23 +1652,23 @@ namespace System.Management.Automation internal static string NotNull(string s) { - return s ?? ""; + return s ?? string.Empty; } private string GetInvocationTypeName() { InvocationInfo invocationInfo = this.InvocationInfo; if (null == invocationInfo) - return ""; + return string.Empty; CommandInfo commandInfo = invocationInfo.MyCommand; if (null == commandInfo) - return ""; + return string.Empty; IScriptCommandInfo scriptInfo = commandInfo as IScriptCommandInfo; if (scriptInfo != null) return commandInfo.Name; CmdletInfo cmdletInfo = commandInfo as CmdletInfo; if (null == cmdletInfo) - return ""; + return string.Empty; return cmdletInfo.ImplementingType.FullName; } diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 27b11fd1a..4dc8aefa0 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -1460,7 +1460,7 @@ namespace System.Management.Automation.Runspaces originalCmdlet[0].Visibility = SessionStateEntryVisibility.Private; // and add a public proxy function - string proxyBody = ProxyCommand.Create(proxyFunction.Value, "", false); + string proxyBody = ProxyCommand.Create(proxyFunction.Value, string.Empty, false); iss.Commands.Add(new SessionStateFunctionEntry(commandName, proxyBody)); } @@ -2416,7 +2416,7 @@ namespace System.Management.Automation.Runspaces // Set the SessionStateDrive here since we have all the provider information at this point SetSessionStateDrive(initializedRunspace.ExecutionContext, true); - Exception moduleImportException = ProcessImportModule(initializedRunspace, ModuleSpecificationsToImport, "", publicCommands); + Exception moduleImportException = ProcessImportModule(initializedRunspace, ModuleSpecificationsToImport, string.Empty, publicCommands); if (moduleImportException != null) { runspaceInitTracer.WriteLine( @@ -2429,7 +2429,7 @@ namespace System.Management.Automation.Runspaces string[] foundModuleList = GetModulesForUnResolvedCommands(UnresolvedCommandsToExpose, initializedRunspace.ExecutionContext); if (foundModuleList.Length > 0) { - ProcessImportModule(initializedRunspace, foundModuleList, "", publicCommands); + ProcessImportModule(initializedRunspace, foundModuleList, string.Empty, publicCommands); } ProcessDynamicVariables(initializedRunspace); @@ -2593,7 +2593,7 @@ namespace System.Management.Automation.Runspaces ProcessCommandModification(commandModification, metadata, unprocessedCommandModification); } - string proxyBody = ProxyCommand.Create(metadata, "", false); + string proxyBody = ProxyCommand.Create(metadata, string.Empty, false); ScriptBlock proxyScriptBlock = ScriptBlock.Create(proxyBody); proxyScriptBlock.LanguageMode = PSLanguageMode.FullLanguage; @@ -3462,7 +3462,7 @@ namespace System.Management.Automation.Runspaces { if (filesProcessed.TryAdd(sste.FileName, null)) { - string moduleName = ""; + string moduleName = string.Empty; if (sste.PSSnapIn != null && !String.IsNullOrEmpty(sste.PSSnapIn.Name)) { moduleName = sste.PSSnapIn.Name; @@ -4582,95 +4582,95 @@ end const ScopedItemOptions ReadOnly = ScopedItemOptions.ReadOnly; return new SessionStateAliasEntry[] { - new SessionStateAliasEntry("foreach", "ForEach-Object", "", ReadOnly_AllScope), - new SessionStateAliasEntry("%", "ForEach-Object", "", ReadOnly_AllScope), - new SessionStateAliasEntry("where", "Where-Object", "", ReadOnly_AllScope), - new SessionStateAliasEntry("?", "Where-Object", "", ReadOnly_AllScope), - new SessionStateAliasEntry("clc", "Clear-Content", "", ReadOnly), - new SessionStateAliasEntry("cli", "Clear-Item", "", ReadOnly), - new SessionStateAliasEntry("clp", "Clear-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("clv", "Clear-Variable", "", ReadOnly), - new SessionStateAliasEntry("cpi", "Copy-Item", "", ReadOnly), - new SessionStateAliasEntry("cvpa", "Convert-Path", "", ReadOnly), - new SessionStateAliasEntry("dbp", "Disable-PSBreakpoint", "", ReadOnly), - new SessionStateAliasEntry("ebp", "Enable-PSBreakpoint", "", ReadOnly), - new SessionStateAliasEntry("epal", "Export-Alias", "", ReadOnly), - new SessionStateAliasEntry("epcsv", "Export-Csv", "", ReadOnly), - new SessionStateAliasEntry("fl", "Format-List", "", ReadOnly), - new SessionStateAliasEntry("ft", "Format-Table", "", ReadOnly), - new SessionStateAliasEntry("fw", "Format-Wide", "", ReadOnly), - new SessionStateAliasEntry("gal", "Get-Alias", "", ReadOnly), - new SessionStateAliasEntry("gbp", "Get-PSBreakpoint", "", ReadOnly), - new SessionStateAliasEntry("gc", "Get-Content", "", ReadOnly), - new SessionStateAliasEntry("gci", "Get-ChildItem", "", ReadOnly), - new SessionStateAliasEntry("gcm", "Get-Command", "", ReadOnly), - new SessionStateAliasEntry("gdr", "Get-PSDrive", "", ReadOnly), - new SessionStateAliasEntry("gcs", "Get-PSCallStack", "", ReadOnly), - new SessionStateAliasEntry("ghy", "Get-History", "", ReadOnly), - new SessionStateAliasEntry("gi", "Get-Item", "", ReadOnly), - new SessionStateAliasEntry("gl", "Get-Location", "", ReadOnly), - new SessionStateAliasEntry("gm", "Get-Member", "", ReadOnly), - new SessionStateAliasEntry("gmo", "Get-Module", "", ReadOnly), - new SessionStateAliasEntry("gp", "Get-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("gpv", "Get-ItemPropertyValue", "",ReadOnly), - new SessionStateAliasEntry("gps", "Get-Process", "", ReadOnly), - new SessionStateAliasEntry("group", "Group-Object", "", ReadOnly), - new SessionStateAliasEntry("gu", "Get-Unique", "", ReadOnly), - new SessionStateAliasEntry("gv", "Get-Variable", "", ReadOnly), - new SessionStateAliasEntry("iex", "Invoke-Expression", "", ReadOnly), - new SessionStateAliasEntry("ihy", "Invoke-History", "", ReadOnly), - new SessionStateAliasEntry("ii", "Invoke-Item", "", ReadOnly), - new SessionStateAliasEntry("ipmo", "Import-Module", "", ReadOnly), - new SessionStateAliasEntry("ipal", "Import-Alias", "", ReadOnly), - new SessionStateAliasEntry("ipcsv", "Import-Csv", "", ReadOnly), - new SessionStateAliasEntry("measure", "Measure-Object", "", ReadOnly), - new SessionStateAliasEntry("mi", "Move-Item", "", ReadOnly), - new SessionStateAliasEntry("mp", "Move-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("nal", "New-Alias", "", ReadOnly), - new SessionStateAliasEntry("ndr", "New-PSDrive", "", ReadOnly), - new SessionStateAliasEntry("ni", "New-Item", "", ReadOnly), - new SessionStateAliasEntry("nv", "New-Variable", "", ReadOnly), - new SessionStateAliasEntry("nmo", "New-Module", "", ReadOnly), - new SessionStateAliasEntry("oh", "Out-Host", "", ReadOnly), - new SessionStateAliasEntry("rbp", "Remove-PSBreakpoint", "", ReadOnly), - new SessionStateAliasEntry("rdr", "Remove-PSDrive", "", ReadOnly), - new SessionStateAliasEntry("ri", "Remove-Item", "", ReadOnly), - new SessionStateAliasEntry("rni", "Rename-Item", "", ReadOnly), - new SessionStateAliasEntry("rnp", "Rename-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("rp", "Remove-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("rmo", "Remove-Module", "", ReadOnly), - new SessionStateAliasEntry("rv", "Remove-Variable", "", ReadOnly), - new SessionStateAliasEntry("rvpa", "Resolve-Path", "", ReadOnly), - new SessionStateAliasEntry("sal", "Set-Alias", "", ReadOnly), - new SessionStateAliasEntry("sbp", "Set-PSBreakpoint", "", ReadOnly), - new SessionStateAliasEntry("select", "Select-Object", "", ReadOnly_AllScope), - new SessionStateAliasEntry("si", "Set-Item", "", ReadOnly), - new SessionStateAliasEntry("sl", "Set-Location", "", ReadOnly), - new SessionStateAliasEntry("sp", "Set-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("saps", "Start-Process", "", ReadOnly), - new SessionStateAliasEntry("spps", "Stop-Process", "", ReadOnly), - new SessionStateAliasEntry("sv", "Set-Variable", "", ReadOnly), + new SessionStateAliasEntry("foreach", "ForEach-Object", string.Empty, ReadOnly_AllScope), + new SessionStateAliasEntry("%", "ForEach-Object", string.Empty, ReadOnly_AllScope), + new SessionStateAliasEntry("where", "Where-Object", string.Empty, ReadOnly_AllScope), + new SessionStateAliasEntry("?", "Where-Object", string.Empty, ReadOnly_AllScope), + new SessionStateAliasEntry("clc", "Clear-Content", string.Empty, ReadOnly), + new SessionStateAliasEntry("cli", "Clear-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("clp", "Clear-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("clv", "Clear-Variable", string.Empty, ReadOnly), + new SessionStateAliasEntry("cpi", "Copy-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("cvpa", "Convert-Path", string.Empty, ReadOnly), + new SessionStateAliasEntry("dbp", "Disable-PSBreakpoint", string.Empty, ReadOnly), + new SessionStateAliasEntry("ebp", "Enable-PSBreakpoint", string.Empty, ReadOnly), + new SessionStateAliasEntry("epal", "Export-Alias", string.Empty, ReadOnly), + new SessionStateAliasEntry("epcsv", "Export-Csv", string.Empty, ReadOnly), + new SessionStateAliasEntry("fl", "Format-List", string.Empty, ReadOnly), + new SessionStateAliasEntry("ft", "Format-Table", string.Empty, ReadOnly), + new SessionStateAliasEntry("fw", "Format-Wide", string.Empty, ReadOnly), + new SessionStateAliasEntry("gal", "Get-Alias", string.Empty, ReadOnly), + new SessionStateAliasEntry("gbp", "Get-PSBreakpoint", string.Empty, ReadOnly), + new SessionStateAliasEntry("gc", "Get-Content", string.Empty, ReadOnly), + new SessionStateAliasEntry("gci", "Get-ChildItem", string.Empty, ReadOnly), + new SessionStateAliasEntry("gcm", "Get-Command", string.Empty, ReadOnly), + new SessionStateAliasEntry("gdr", "Get-PSDrive", string.Empty, ReadOnly), + new SessionStateAliasEntry("gcs", "Get-PSCallStack", string.Empty, ReadOnly), + new SessionStateAliasEntry("ghy", "Get-History", string.Empty, ReadOnly), + new SessionStateAliasEntry("gi", "Get-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("gl", "Get-Location", string.Empty, ReadOnly), + new SessionStateAliasEntry("gm", "Get-Member", string.Empty, ReadOnly), + new SessionStateAliasEntry("gmo", "Get-Module", string.Empty, ReadOnly), + new SessionStateAliasEntry("gp", "Get-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("gpv", "Get-ItemPropertyValue", string.Empty,ReadOnly), + new SessionStateAliasEntry("gps", "Get-Process", string.Empty, ReadOnly), + new SessionStateAliasEntry("group", "Group-Object", string.Empty, ReadOnly), + new SessionStateAliasEntry("gu", "Get-Unique", string.Empty, ReadOnly), + new SessionStateAliasEntry("gv", "Get-Variable", string.Empty, ReadOnly), + new SessionStateAliasEntry("iex", "Invoke-Expression", string.Empty, ReadOnly), + new SessionStateAliasEntry("ihy", "Invoke-History", string.Empty, ReadOnly), + new SessionStateAliasEntry("ii", "Invoke-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("ipmo", "Import-Module", string.Empty, ReadOnly), + new SessionStateAliasEntry("ipal", "Import-Alias", string.Empty, ReadOnly), + new SessionStateAliasEntry("ipcsv", "Import-Csv", string.Empty, ReadOnly), + new SessionStateAliasEntry("measure", "Measure-Object", string.Empty, ReadOnly), + new SessionStateAliasEntry("mi", "Move-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("mp", "Move-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("nal", "New-Alias", string.Empty, ReadOnly), + new SessionStateAliasEntry("ndr", "New-PSDrive", string.Empty, ReadOnly), + new SessionStateAliasEntry("ni", "New-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("nv", "New-Variable", string.Empty, ReadOnly), + new SessionStateAliasEntry("nmo", "New-Module", string.Empty, ReadOnly), + new SessionStateAliasEntry("oh", "Out-Host", string.Empty, ReadOnly), + new SessionStateAliasEntry("rbp", "Remove-PSBreakpoint", string.Empty, ReadOnly), + new SessionStateAliasEntry("rdr", "Remove-PSDrive", string.Empty, ReadOnly), + new SessionStateAliasEntry("ri", "Remove-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("rni", "Rename-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("rnp", "Rename-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("rp", "Remove-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("rmo", "Remove-Module", string.Empty, ReadOnly), + new SessionStateAliasEntry("rv", "Remove-Variable", string.Empty, ReadOnly), + new SessionStateAliasEntry("rvpa", "Resolve-Path", string.Empty, ReadOnly), + new SessionStateAliasEntry("sal", "Set-Alias", string.Empty, ReadOnly), + new SessionStateAliasEntry("sbp", "Set-PSBreakpoint", string.Empty, ReadOnly), + new SessionStateAliasEntry("select", "Select-Object", string.Empty, ReadOnly_AllScope), + new SessionStateAliasEntry("si", "Set-Item", string.Empty, ReadOnly), + new SessionStateAliasEntry("sl", "Set-Location", string.Empty, ReadOnly), + new SessionStateAliasEntry("sp", "Set-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("saps", "Start-Process", string.Empty, ReadOnly), + new SessionStateAliasEntry("spps", "Stop-Process", string.Empty, ReadOnly), + new SessionStateAliasEntry("sv", "Set-Variable", string.Empty, ReadOnly), // Web cmdlets aliases - new SessionStateAliasEntry("irm", "Invoke-RestMethod", "", ReadOnly), - new SessionStateAliasEntry("iwr", "Invoke-WebRequest", "", ReadOnly), + new SessionStateAliasEntry("irm", "Invoke-RestMethod", string.Empty, ReadOnly), + new SessionStateAliasEntry("iwr", "Invoke-WebRequest", string.Empty, ReadOnly), // Porting note: #if !UNIX is used to disable aliases for cmdlets which conflict with Linux / macOS #if !UNIX // ac is a native command on macOS - new SessionStateAliasEntry("ac", "Add-Content", "", ReadOnly), - new SessionStateAliasEntry("compare", "Compare-Object", "", ReadOnly), - new SessionStateAliasEntry("cpp", "Copy-ItemProperty", "", ReadOnly), - new SessionStateAliasEntry("diff", "Compare-Object", "", ReadOnly), - new SessionStateAliasEntry("gsv", "Get-Service", "", ReadOnly), - new SessionStateAliasEntry("sleep", "Start-Sleep", "", ReadOnly), - new SessionStateAliasEntry("sort", "Sort-Object", "", ReadOnly), - new SessionStateAliasEntry("start", "Start-Process", "", ReadOnly), - new SessionStateAliasEntry("sasv", "Start-Service", "", ReadOnly), - new SessionStateAliasEntry("spsv", "Stop-Service", "", ReadOnly), - new SessionStateAliasEntry("tee", "Tee-Object", "", ReadOnly), - new SessionStateAliasEntry("write", "Write-Output", "", ReadOnly), + new SessionStateAliasEntry("ac", "Add-Content", string.Empty, ReadOnly), + new SessionStateAliasEntry("compare", "Compare-Object", string.Empty, ReadOnly), + new SessionStateAliasEntry("cpp", "Copy-ItemProperty", string.Empty, ReadOnly), + new SessionStateAliasEntry("diff", "Compare-Object", string.Empty, ReadOnly), + new SessionStateAliasEntry("gsv", "Get-Service", string.Empty, ReadOnly), + new SessionStateAliasEntry("sleep", "Start-Sleep", string.Empty, ReadOnly), + new SessionStateAliasEntry("sort", "Sort-Object", string.Empty, ReadOnly), + new SessionStateAliasEntry("start", "Start-Process", string.Empty, ReadOnly), + new SessionStateAliasEntry("sasv", "Start-Service", string.Empty, ReadOnly), + new SessionStateAliasEntry("spsv", "Stop-Service", string.Empty, ReadOnly), + new SessionStateAliasEntry("tee", "Tee-Object", string.Empty, ReadOnly), + new SessionStateAliasEntry("write", "Write-Output", string.Empty, ReadOnly), // These were transferred from the "transferred from the profile" section new SessionStateAliasEntry("cat", "Get-Content"), - new SessionStateAliasEntry("cp", "Copy-Item", "", AllScope), + new SessionStateAliasEntry("cp", "Copy-Item", string.Empty, AllScope), new SessionStateAliasEntry("ls", "Get-ChildItem"), new SessionStateAliasEntry("man", "help"), new SessionStateAliasEntry("mount", "New-PSDrive"), @@ -4678,14 +4678,14 @@ end new SessionStateAliasEntry("ps", "Get-Process"), new SessionStateAliasEntry("rm", "Remove-Item"), new SessionStateAliasEntry("rmdir", "Remove-Item"), - new SessionStateAliasEntry("cnsn", "Connect-PSSession", "", ReadOnly), - new SessionStateAliasEntry("dnsn", "Disconnect-PSSession", "", ReadOnly), + new SessionStateAliasEntry("cnsn", "Connect-PSSession", string.Empty, ReadOnly), + new SessionStateAliasEntry("dnsn", "Disconnect-PSSession", string.Empty, ReadOnly), #endif // Bash built-ins we purposefully keep even if they override native commands - new SessionStateAliasEntry("cd", "Set-Location", "", AllScope), - new SessionStateAliasEntry("dir", "Get-ChildItem", "", AllScope), - new SessionStateAliasEntry("echo", "Write-Output", "", AllScope), - new SessionStateAliasEntry("fc", "Format-Custom", "", ReadOnly), + new SessionStateAliasEntry("cd", "Set-Location", string.Empty, AllScope), + new SessionStateAliasEntry("dir", "Get-ChildItem", string.Empty, AllScope), + new SessionStateAliasEntry("echo", "Write-Output", string.Empty, AllScope), + new SessionStateAliasEntry("fc", "Format-Custom", string.Empty, ReadOnly), new SessionStateAliasEntry("kill", "Stop-Process"), new SessionStateAliasEntry("pwd", "Get-Location"), new SessionStateAliasEntry("type", "Get-Content"), @@ -4693,35 +4693,35 @@ end new SessionStateAliasEntry("clear", "Clear-Host"), //#if !CORECLR is used to disable aliases for cmdlets which are not available on OneCore or not appropriate for PSCore6 due to conflicts #if !CORECLR - new SessionStateAliasEntry("gwmi", "Get-WmiObject", "", ReadOnly), - new SessionStateAliasEntry("iwmi", "Invoke-WMIMethod", "", ReadOnly), - new SessionStateAliasEntry("ogv", "Out-GridView", "", ReadOnly), - new SessionStateAliasEntry("ise", "powershell_ise.exe", "", ReadOnly), - new SessionStateAliasEntry("rwmi", "Remove-WMIObject", "", ReadOnly), - new SessionStateAliasEntry("sc", "Set-Content", "", ReadOnly), - new SessionStateAliasEntry("swmi", "Set-WMIInstance", "", ReadOnly), - new SessionStateAliasEntry("shcm", "Show-Command", "", ReadOnly), - new SessionStateAliasEntry("trcm", "Trace-Command", "", ReadOnly), + new SessionStateAliasEntry("gwmi", "Get-WmiObject", string.Empty, ReadOnly), + new SessionStateAliasEntry("iwmi", "Invoke-WMIMethod", string.Empty, ReadOnly), + new SessionStateAliasEntry("ogv", "Out-GridView", string.Empty, ReadOnly), + new SessionStateAliasEntry("ise", "powershell_ise.exe", string.Empty, ReadOnly), + new SessionStateAliasEntry("rwmi", "Remove-WMIObject", string.Empty, ReadOnly), + new SessionStateAliasEntry("sc", "Set-Content", string.Empty, ReadOnly), + new SessionStateAliasEntry("swmi", "Set-WMIInstance", string.Empty, ReadOnly), + new SessionStateAliasEntry("shcm", "Show-Command", string.Empty, ReadOnly), + new SessionStateAliasEntry("trcm", "Trace-Command", string.Empty, ReadOnly), new SessionStateAliasEntry("lp", "Out-Printer"), #endif // Aliases transferred from the profile new SessionStateAliasEntry("h", "Get-History"), new SessionStateAliasEntry("history", "Get-History"), - new SessionStateAliasEntry("md", "mkdir", "", AllScope), - new SessionStateAliasEntry("popd", "Pop-Location", "", AllScope), - new SessionStateAliasEntry("pushd", "Push-Location", "", AllScope), + new SessionStateAliasEntry("md", "mkdir", string.Empty, AllScope), + new SessionStateAliasEntry("popd", "Pop-Location", string.Empty, AllScope), + new SessionStateAliasEntry("pushd", "Push-Location", string.Empty, AllScope), new SessionStateAliasEntry("r", "Invoke-History"), new SessionStateAliasEntry("cls", "Clear-Host"), new SessionStateAliasEntry("chdir", "Set-Location"), - new SessionStateAliasEntry("copy", "Copy-Item", "", AllScope), - new SessionStateAliasEntry("del", "Remove-Item", "", AllScope), + new SessionStateAliasEntry("copy", "Copy-Item", string.Empty, AllScope), + new SessionStateAliasEntry("del", "Remove-Item", string.Empty, AllScope), new SessionStateAliasEntry("erase", "Remove-Item"), - new SessionStateAliasEntry("move", "Move-Item", "", AllScope), + new SessionStateAliasEntry("move", "Move-Item", string.Empty, AllScope), new SessionStateAliasEntry("rd", "Remove-Item"), new SessionStateAliasEntry("ren", "Rename-Item"), new SessionStateAliasEntry("set", "Set-Variable"), new SessionStateAliasEntry("icm", "Invoke-Command"), - new SessionStateAliasEntry("clhy", "Clear-History", "", ReadOnly), + new SessionStateAliasEntry("clhy", "Clear-History", string.Empty, ReadOnly), // Job Specific aliases new SessionStateAliasEntry("gjb", "Get-Job"), new SessionStateAliasEntry("rcjb", "Receive-Job"), @@ -4733,7 +4733,7 @@ end new SessionStateAliasEntry("sujb", "Suspend-Job"), new SessionStateAliasEntry("rujb", "Resume-Job"), // Remoting Cmdlets Specific aliases - new SessionStateAliasEntry("npssc", "New-PSSessionConfigurationFile", "", ReadOnly), + new SessionStateAliasEntry("npssc", "New-PSSessionConfigurationFile", string.Empty, ReadOnly), new SessionStateAliasEntry("ipsn", "Import-PSSession"), new SessionStateAliasEntry("epsn", "Export-PSSession"), #endif @@ -4741,7 +4741,7 @@ end new SessionStateAliasEntry("gsn", "Get-PSSession"), new SessionStateAliasEntry("rsn", "Remove-PSSession"), new SessionStateAliasEntry("etsn", "Enter-PSSession"), - new SessionStateAliasEntry("rcsn", "Receive-PSSession", "", ReadOnly), + new SessionStateAliasEntry("rcsn", "Receive-PSSession", string.Empty, ReadOnly), new SessionStateAliasEntry("exsn", "Exit-PSSession"), // Win8: 121662/169179 Add "sls" alias for Select-String cmdlet // - do not use AllScope - this causes errors in profiles that set this somewhat commonly used alias. @@ -5273,7 +5273,7 @@ end // because we believe a user of the cmdlet, instead of the author of it, // should be the one to decide the option // ('ScopedItemOptions.ReadOnly' and/or 'ScopedItemOptions.AllScopes') of the alias usage." - var aliasEntry = new SessionStateAliasEntry(alias, cmdletName, "", ScopedItemOptions.None); + var aliasEntry = new SessionStateAliasEntry(alias, cmdletName, string.Empty, ScopedItemOptions.None); if (psSnapInInfo != null) { aliasEntry.SetPSSnapIn(psSnapInInfo); diff --git a/src/System.Management.Automation/engine/InvocationInfo.cs b/src/System.Management.Automation/engine/InvocationInfo.cs index d104584d6..385307b8c 100644 --- a/src/System.Management.Automation/engine/InvocationInfo.cs +++ b/src/System.Management.Automation/engine/InvocationInfo.cs @@ -252,7 +252,7 @@ namespace System.Management.Automation /// The script name or "" if there was no script. public string ScriptName { - get { return ScriptPosition.File ?? ""; } + get { return ScriptPosition.File ?? string.Empty; } } /// @@ -315,7 +315,7 @@ namespace System.Management.Automation /// The name string. public string InvocationName { - get { return _invocationName ?? ""; } + get { return _invocationName ?? string.Empty; } internal set { _invocationName = value; } } diff --git a/src/System.Management.Automation/engine/ManagementObjectAdapter.cs b/src/System.Management.Automation/engine/ManagementObjectAdapter.cs index 15518567e..fd09c598a 100644 --- a/src/System.Management.Automation/engine/ManagementObjectAdapter.cs +++ b/src/System.Management.Automation/engine/ManagementObjectAdapter.cs @@ -560,7 +560,7 @@ namespace System.Management.Automation { string cimType = (string)pData.Qualifiers["cimtype"].Value; result = string.Format(CultureInfo.InvariantCulture, "{0}#{1}", - typeof(ManagementObject).FullName, cimType.Replace("object:", "")); + typeof(ManagementObject).FullName, cimType.Replace("object:", string.Empty)); } catch (ManagementException) { diff --git a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs index 4903fabed..dfa78af0f 100644 --- a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs @@ -478,7 +478,7 @@ namespace Microsoft.PowerShell.Commands { // if the module in the moduleTable is an assembly module without path, the moduleName is the key. string moduleName = "dynamic_code_module_" + suppliedAssembly; - if (pair.Value.Path == "") + if (pair.Value.Path == string.Empty) { if (pair.Key.Equals(moduleName, StringComparison.OrdinalIgnoreCase)) { @@ -1219,7 +1219,7 @@ namespace Microsoft.PowerShell.Commands return true; } - if (manifestEntries.Any(s => FixupFileName("", s, ".ps1xml").EndsWith(cimModuleFile.FileName, StringComparison.OrdinalIgnoreCase))) + if (manifestEntries.Any(s => FixupFileName(string.Empty, s, ".ps1xml").EndsWith(cimModuleFile.FileName, StringComparison.OrdinalIgnoreCase))) { return true; } diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index 8c64918fd..0e42cfa76 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -4693,7 +4693,7 @@ namespace Microsoft.PowerShell.Commands // if the module path is empty string, means it is a dynamically generated assembly. // We have set the module path to be module name as key to make it unique, we need update here as well in case the module can be removed. - if (module.Path == "") + if (module.Path == string.Empty) { module.Path = module.Name; } @@ -6049,7 +6049,7 @@ namespace Microsoft.PowerShell.Commands { if (SessionStateUtilities.MatchesAnyWildcardPattern(command, scriptAnalysisPatterns, true)) { - if (!HasInvalidCharacters(command.Replace("-", ""))) + if (!HasInvalidCharacters(command.Replace("-", string.Empty))) { module.AddDetectedFunctionExport(command); } @@ -6061,7 +6061,7 @@ namespace Microsoft.PowerShell.Commands { var commandName = pair.Key; // These are already filtered - if (!HasInvalidCharacters(commandName.Replace("-", ""))) + if (!HasInvalidCharacters(commandName.Replace("-", string.Empty))) { module.AddDetectedAliasExport(commandName, pair.Value); } @@ -6133,7 +6133,7 @@ namespace Microsoft.PowerShell.Commands if (SessionStateUtilities.MatchesAnyWildcardPattern(commandName, patterns, true) && SessionStateUtilities.MatchesAnyWildcardPattern(commandName, scriptAnalysisPatterns, true)) { - if (!HasInvalidCharacters(commandName.Replace("-", ""))) + if (!HasInvalidCharacters(commandName.Replace("-", string.Empty))) { module.AddDetectedFunctionExport(commandName); } @@ -6145,7 +6145,7 @@ namespace Microsoft.PowerShell.Commands if (SessionStateUtilities.MatchesAnyWildcardPattern(commandName, patterns, true) && SessionStateUtilities.MatchesAnyWildcardPattern(commandName, scriptAnalysisPatterns, true)) { - if (!HasInvalidCharacters(commandName.Replace("-", ""))) + if (!HasInvalidCharacters(commandName.Replace("-", string.Empty))) { module.AddDetectedCmdletExport(commandName); } @@ -6742,7 +6742,7 @@ namespace Microsoft.PowerShell.Commands // if the module path is empty (assembly module in memory), we add the modulename as key string moduleTableKey; - if (module.Path != "") + if (module.Path != string.Empty) { moduleTableKey = module.Path; } diff --git a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs index 3f73906a0..ce50d21f0 100644 --- a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs @@ -85,7 +85,7 @@ namespace Microsoft.PowerShell.Commands get { return _companyName; } set { _companyName = value; } } - private string _companyName = ""; + private string _companyName = string.Empty; /// /// Set the copyright string in the module manifest @@ -472,7 +472,7 @@ namespace Microsoft.PowerShell.Commands } private string _defaultCommandPrefix; - private string _indent = ""; + private string _indent = string.Empty; /// /// Return a single-quoted string. Any embedded single quotes will be doubled. @@ -956,16 +956,16 @@ namespace Microsoft.PowerShell.Commands StringBuilder result = new StringBuilder(); // Insert the formatted manifest header... - result.Append(ManifestComment("", streamWriter)); + result.Append(ManifestComment(string.Empty, streamWriter)); result.Append(ManifestComment(StringUtil.Format(Modules.ManifestHeaderLine1, System.IO.Path.GetFileNameWithoutExtension(filePath)), streamWriter)); - result.Append(ManifestComment("", streamWriter)); + result.Append(ManifestComment(string.Empty, streamWriter)); result.Append(ManifestComment(StringUtil.Format(Modules.ManifestHeaderLine2, _author), streamWriter)); - result.Append(ManifestComment("", streamWriter)); + result.Append(ManifestComment(string.Empty, streamWriter)); result.Append(ManifestComment(StringUtil.Format(Modules.ManifestHeaderLine3, DateTime.Now.ToString("d", CultureInfo.CurrentCulture)), streamWriter)); - result.Append(ManifestComment("", streamWriter)); + result.Append(ManifestComment(string.Empty, streamWriter)); result.Append(streamWriter.NewLine); result.Append("@{"); result.Append(streamWriter.NewLine); @@ -1145,7 +1145,7 @@ namespace Microsoft.PowerShell.Commands result.Append("} "); result.Append(ManifestComment(StringUtil.Format(Modules.EndOfManifestHashTable, "PrivateData"), streamWriter)); - _indent = ""; + _indent = string.Empty; result.Append(streamWriter.NewLine); } diff --git a/src/System.Management.Automation/engine/Modules/RemoteDiscoveryHelper.cs b/src/System.Management.Automation/engine/Modules/RemoteDiscoveryHelper.cs index e5f3fc842..cac6faa18 100644 --- a/src/System.Management.Automation/engine/Modules/RemoteDiscoveryHelper.cs +++ b/src/System.Management.Automation/engine/Modules/RemoteDiscoveryHelper.cs @@ -1012,8 +1012,8 @@ namespace System.Management.Automation { computerName = computerName ?? string.Empty; - string sanitizedRemoteModuleName = Regex.Replace(remoteModuleName, "[^a-zA-Z0-9]", ""); - string sanitizedComputerName = Regex.Replace(computerName, "[^a-zA-Z0-9]", ""); + string sanitizedRemoteModuleName = Regex.Replace(remoteModuleName, "[^a-zA-Z0-9]", string.Empty); + string sanitizedComputerName = Regex.Replace(computerName, "[^a-zA-Z0-9]", string.Empty); string moduleName = string.Format( CultureInfo.InvariantCulture, "remoteIpMoProxy_{0}_{1}_{2}_{3}", diff --git a/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs b/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs index 0178f4220..21f77b15e 100644 --- a/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs +++ b/src/System.Management.Automation/engine/Modules/ScriptAnalysis.cs @@ -553,4 +553,4 @@ namespace System.Management.Automation internal string Name { get; set; } internal List CommandsToPostFilter { get; set; } } -} // System.Management.Automation \ No newline at end of file +} // System.Management.Automation diff --git a/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs index 39cf4b94e..d34665801 100644 --- a/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs @@ -131,7 +131,7 @@ namespace Microsoft.PowerShell.Commands } //RootModule can be null, empty string or point to a valid .psm1, , .cdxml, .xaml or .dll. Anything else is invalid. - if (module.RootModule != null && module.RootModule != "") + if (module.RootModule != null && module.RootModule != string.Empty) { string rootModuleExt = System.IO.Path.GetExtension(module.RootModule); if ((!IsValidFilePath(module.RootModule, module, true) && !IsValidGacAssembly(module.RootModule)) || diff --git a/src/System.Management.Automation/engine/MshMemberInfo.cs b/src/System.Management.Automation/engine/MshMemberInfo.cs index b19f099db..d9d456999 100644 --- a/src/System.Management.Automation/engine/MshMemberInfo.cs +++ b/src/System.Management.Automation/engine/MshMemberInfo.cs @@ -2013,7 +2013,7 @@ namespace System.Management.Automation public override string ToString() { StringBuilder sb = new StringBuilder(); - string separator = ""; + string separator = string.Empty; if (MethodTargetType != null) { sb.Append("this: "); @@ -2025,7 +2025,7 @@ namespace System.Management.Automation { sb.Append(separator); sb.Append("args: "); - separator = ""; + separator = string.Empty; foreach (var p in _parameterTypes) { sb.Append(separator); diff --git a/src/System.Management.Automation/engine/MshObject.cs b/src/System.Management.Automation/engine/MshObject.cs index f786edd6e..822dc3fe0 100644 --- a/src/System.Management.Automation/engine/MshObject.cs +++ b/src/System.Management.Automation/engine/MshObject.cs @@ -2362,7 +2362,7 @@ namespace System.Management.Automation /// public override string ToString() { - return ""; + return string.Empty; } } diff --git a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs index 4b0b2d9af..e55d1b781 100644 --- a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs +++ b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs @@ -168,7 +168,7 @@ namespace System.Management.Automation "array argument and ArrayLiteralAst differ in number of elements"); int currentElement = -1; - string separator = ""; + string separator = string.Empty; do { string arg; @@ -275,7 +275,7 @@ namespace System.Management.Automation // Expand paths, but only from the file system. if (paths?.Count > 0 && paths.All(p => p.BaseObject is FileSystemInfo)) { - var sep = ""; + var sep = string.Empty; foreach (var path in paths) { _arguments.Append(sep); diff --git a/src/System.Management.Automation/engine/ParameterBinderBase.cs b/src/System.Management.Automation/engine/ParameterBinderBase.cs index b7e81e363..7c25559d4 100644 --- a/src/System.Management.Automation/engine/ParameterBinderBase.cs +++ b/src/System.Management.Automation/engine/ParameterBinderBase.cs @@ -648,7 +648,7 @@ namespace System.Management.Automation if (values != null) { var sb = new Text.StringBuilder(256); - var sep = ""; + var sep = string.Empty; foreach (var value in values) { sb.Append(sep); @@ -1189,7 +1189,7 @@ namespace System.Management.Automation ParameterBinderStrings.CannotConvertArgument, "CannotConvertArgument", boType, - ""); + string.Empty); throw pbe; } @@ -1388,7 +1388,7 @@ namespace System.Management.Automation null, ParameterBinderStrings.ParameterArgumentValidationErrorNullNotAllowed, "ParameterArgumentValidationErrorNullNotAllowed", - ""); + string.Empty); throw exception; } @@ -1628,7 +1628,7 @@ namespace System.Management.Automation currentValue.GetType(), ParameterBinderStrings.CannotExtractAddMethod, "CannotExtractAddMethod", - (getMethodError == null) ? "" : getMethodError.Message); + (getMethodError == null) ? string.Empty : getMethodError.Message); throw bindingException; } } diff --git a/src/System.Management.Automation/engine/ProxyCommand.cs b/src/System.Management.Automation/engine/ProxyCommand.cs index 8d36b4f9d..d90c9f589 100644 --- a/src/System.Management.Automation/engine/ProxyCommand.cs +++ b/src/System.Management.Automation/engine/ProxyCommand.cs @@ -44,7 +44,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("commandMetaData"); } - return commandMetadata.GetProxyCommand("", true); + return commandMetadata.GetProxyCommand(string.Empty, true); } /// diff --git a/src/System.Management.Automation/engine/SessionState.cs b/src/System.Management.Automation/engine/SessionState.cs index 3a8074521..cb858009a 100644 --- a/src/System.Management.Automation/engine/SessionState.cs +++ b/src/System.Management.Automation/engine/SessionState.cs @@ -361,7 +361,7 @@ namespace System.Management.Automation // $PSHOME // This depends on the shellId. If we cannot read the application base // registry key, set the variable to empty string - string applicationBase = ""; + string applicationBase = string.Empty; try { applicationBase = Utils.GetApplicationBase(shellId); diff --git a/src/System.Management.Automation/engine/SessionStatePublic.cs b/src/System.Management.Automation/engine/SessionStatePublic.cs index 707f588b5..db671697e 100644 --- a/src/System.Management.Automation/engine/SessionStatePublic.cs +++ b/src/System.Management.Automation/engine/SessionStatePublic.cs @@ -222,7 +222,7 @@ namespace System.Management.Automation { exception = new SessionStateException( - "", + string.Empty, SessionStateCategory.Command, "CommandIsPrivate", SessionStateStrings.CommandIsPrivate, diff --git a/src/System.Management.Automation/engine/TransactedString.cs b/src/System.Management.Automation/engine/TransactedString.cs index c337ccf8d..55560efa1 100644 --- a/src/System.Management.Automation/engine/TransactedString.cs +++ b/src/System.Management.Automation/engine/TransactedString.cs @@ -19,7 +19,7 @@ namespace Microsoft.PowerShell.Commands.Management /// /// Constructor for the TransactedString class. /// - public TransactedString() : this("") + public TransactedString() : this(string.Empty) { } diff --git a/src/System.Management.Automation/engine/TypeMetadata.cs b/src/System.Management.Automation/engine/TypeMetadata.cs index 352ea45aa..ef2ee9f37 100644 --- a/src/System.Management.Automation/engine/TypeMetadata.cs +++ b/src/System.Management.Automation/engine/TypeMetadata.cs @@ -304,7 +304,7 @@ namespace System.Management.Automation internal string GetProxyParameterData() { Text.StringBuilder result = new System.Text.StringBuilder(); - string prefix = ""; + string prefix = string.Empty; if (_isMandatory) { @@ -716,7 +716,7 @@ namespace System.Management.Automation } var wildcardPattern = WildcardPattern.Get( - "*" + (psTypeName.Name ?? ""), + "*" + (psTypeName.Name ?? string.Empty), WildcardOptions.IgnoreCase | WildcardOptions.CultureInvariant); if (wildcardPattern.IsMatch(this.ParameterType.FullName)) { @@ -788,7 +788,7 @@ namespace System.Management.Automation string paramSetData = parameterSet.GetProxyParameterData(); if (!string.IsNullOrEmpty(paramSetData) || !parameterSetName.Equals(ParameterAttribute.AllParameterSets)) { - string separator = ""; + string separator = string.Empty; result.Append(prefix); result.Append("[Parameter("); if (!parameterSetName.Equals(ParameterAttribute.AllParameterSets)) @@ -812,7 +812,7 @@ namespace System.Management.Automation if ((_aliases != null) && (_aliases.Count > 0)) { Text.StringBuilder aliasesData = new System.Text.StringBuilder(); - string comma = ""; // comma is not need for the first element + string comma = string.Empty; // comma is not need for the first element foreach (string alias in _aliases) { @@ -942,7 +942,7 @@ namespace System.Management.Automation { /* TODO: Validate Pattern dont support Options in ScriptCmdletText. StringBuilder regexOps = new System.Text.StringBuilder(); - string or = ""; + string or = string.Empty; string[] regexOptionEnumValues = Enum.GetNames(typeof(System.Text.RegularExpressions.RegexOptions)); foreach(string regexOption in regexOptionEnumValues) @@ -996,7 +996,7 @@ namespace System.Management.Automation if (setAttrib != null) { Text.StringBuilder values = new System.Text.StringBuilder(); - string comma = ""; + string comma = string.Empty; foreach (string validValue in setAttrib.ValidValues) { values.AppendFormat( diff --git a/src/System.Management.Automation/engine/Types_Ps1Xml.cs b/src/System.Management.Automation/engine/Types_Ps1Xml.cs index 2599cf595..12dfc6ec7 100644 --- a/src/System.Management.Automation/engine/Types_Ps1Xml.cs +++ b/src/System.Management.Automation/engine/Types_Ps1Xml.cs @@ -1292,7 +1292,7 @@ namespace System.Management.Automation.Runspaces { if ($argumentsBuilder.Length -gt 1) { - $argumentsBuilder.Append("", ""); + $argumentsBuilder.Append(string.Empty, string.Empty); } $argumentsBuilder.Append($entry.Key).Append(""="") @@ -1307,7 +1307,7 @@ namespace System.Management.Automation.Runspaces { if ($argumentsBuilder.Length -gt 1) { - $argumentsBuilder.Append("", "") + $argumentsBuilder.Append(string.Empty, string.Empty) } if ($arg) { diff --git a/src/System.Management.Automation/engine/VariableAttributeCollection.cs b/src/System.Management.Automation/engine/VariableAttributeCollection.cs index e8bbeb56a..5d7855660 100644 --- a/src/System.Management.Automation/engine/VariableAttributeCollection.cs +++ b/src/System.Management.Automation/engine/VariableAttributeCollection.cs @@ -156,7 +156,7 @@ namespace System.Management.Automation null, Metadata.InvalidMetadataForCurrentValue, _variable.Name, - ((_variable.Value != null) ? _variable.Value.ToString() : "")); + ((_variable.Value != null) ? _variable.Value.ToString() : string.Empty)); throw e; } diff --git a/src/System.Management.Automation/engine/WorkflowInfo.cs b/src/System.Management.Automation/engine/WorkflowInfo.cs index d16f906bb..6a316ad84 100644 --- a/src/System.Management.Automation/engine/WorkflowInfo.cs +++ b/src/System.Management.Automation/engine/WorkflowInfo.cs @@ -281,7 +281,7 @@ namespace System.Management.Automation { get { return _definition; } } - private string _definition = ""; + private string _definition = string.Empty; /// /// Gets the XAML that represents the definition of the workflow. diff --git a/src/System.Management.Automation/engine/cmdlet.cs b/src/System.Management.Automation/engine/cmdlet.cs index 8d1574768..9fc23c710 100644 --- a/src/System.Management.Automation/engine/cmdlet.cs +++ b/src/System.Management.Automation/engine/cmdlet.cs @@ -119,7 +119,7 @@ namespace System.Management.Automation { _parameterSetName = parameterSetName; } - private string _parameterSetName = ""; + private string _parameterSetName = string.Empty; #region Override Internal diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index c124d6d44..89525e285 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -4956,28 +4956,28 @@ namespace System.Management.Automation /// private void DisplayHelp(PSHost host, IList output) { - WriteLine("", host, output); + WriteLine(string.Empty, host, output); WriteLine(StringUtil.Format(DebuggerStrings.StepHelp, StepShortcut, StepCommand), host, output); WriteLine(StringUtil.Format(DebuggerStrings.StepOverHelp, StepOverShortcut, StepOverCommand), host, output); WriteLine(StringUtil.Format(DebuggerStrings.StepOutHelp, StepOutShortcut, StepOutCommand), host, output); - WriteLine("", host, output); + WriteLine(string.Empty, host, output); WriteLine(StringUtil.Format(DebuggerStrings.ContinueHelp, ContinueShortcut, ContinueCommand), host, output); WriteLine(StringUtil.Format(DebuggerStrings.StopHelp, StopShortcut, StopCommand), host, output); WriteLine(StringUtil.Format(DebuggerStrings.DetachHelp, DetachShortcut, DetachCommand), host, output); - WriteLine("", host, output); + WriteLine(string.Empty, host, output); WriteLine(StringUtil.Format(DebuggerStrings.GetStackTraceHelp, GetStackTraceShortcut), host, output); - WriteLine("", host, output); + WriteLine(string.Empty, host, output); WriteLine(StringUtil.Format(DebuggerStrings.ListHelp, ListShortcut, ListCommand), host, output); WriteLine(StringUtil.Format(DebuggerStrings.AdditionalListHelp1), host, output); WriteLine(StringUtil.Format(DebuggerStrings.AdditionalListHelp2), host, output); WriteLine(StringUtil.Format(DebuggerStrings.AdditionalListHelp3), host, output); - WriteLine("", host, output); + WriteLine(string.Empty, host, output); WriteLine(StringUtil.Format(DebuggerStrings.EnterHelp, StepCommand, StepOverCommand, ListCommand), host, output); - WriteLine("", host, output); + WriteLine(string.Empty, host, output); WriteLine(StringUtil.Format(DebuggerStrings.HelpCommandHelp, HelpShortcut, HelpCommand), host, output); WriteLine("\n", host, output); WriteLine(StringUtil.Format(DebuggerStrings.PromptHelp), host, output); - WriteLine("", host, output); + WriteLine(string.Empty, host, output); } /// diff --git a/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs b/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs index f0499133c..6296f7e28 100644 --- a/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs +++ b/src/System.Management.Automation/engine/hostifaces/ChoiceDescription.cs @@ -19,7 +19,7 @@ namespace System.Management.Automation.Host #region DO NOT REMOVE OR RENAME THESE FIELDS - it will break remoting compatibility with Windows PowerShell compatibility with Windows PowerShell private readonly string label = null; - private string helpMessage = ""; + private string helpMessage = string.Empty; #endregion diff --git a/src/System.Management.Automation/engine/hostifaces/Command.cs b/src/System.Management.Automation/engine/hostifaces/Command.cs index e4b3566b2..f3710cc21 100644 --- a/src/System.Management.Automation/engine/hostifaces/Command.cs +++ b/src/System.Management.Automation/engine/hostifaces/Command.cs @@ -478,7 +478,7 @@ namespace System.Management.Automation.Runspaces if (scriptBlock.UsesCmdletBinding) { - FunctionInfo functionInfo = new FunctionInfo("", scriptBlock, executionContext); + FunctionInfo functionInfo = new FunctionInfo(string.Empty, scriptBlock, executionContext); commandProcessorBase = new CommandProcessor(functionInfo, executionContext, _useLocalScope ?? false, fromScriptFile: false, sessionState: executionContext.EngineSessionState); } diff --git a/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs b/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs index a5cf51f29..f4d7b14db 100644 --- a/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs +++ b/src/System.Management.Automation/engine/hostifaces/FieldDescription.cs @@ -466,11 +466,11 @@ namespace System.Management.Automation.Host #region DO NOT REMOVE OR RENAME THESE FIELDS - it will break remoting compatibility with Windows PowerShell private readonly string name = null; - private string label = ""; + private string label = string.Empty; private string parameterTypeName = null; private string parameterTypeFullName = null; private string parameterAssemblyFullName = null; - private string helpMessage = ""; + private string helpMessage = string.Empty; private bool isMandatory = true; private PSObject defaultValue = null; diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs index 438b457e9..9a15ae33b 100644 --- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs @@ -186,7 +186,7 @@ namespace System.Management.Automation basePath = GetAllUsersFolderPath(shellId); if (string.IsNullOrEmpty(basePath)) { - return ""; + return string.Empty; } } diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs index cf69c0077..f227dbdd8 100644 --- a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs @@ -1026,10 +1026,10 @@ namespace System.Management.Automation.Internal.Host } // default choices - string defaultPrompt = ""; + string defaultPrompt = string.Empty; if (defaultChoiceKeys.Count > 0) { - string prepend = ""; + string prepend = string.Empty; Text.StringBuilder defaultChoicesBuilder = new Text.StringBuilder(); foreach (int defaultChoice in defaultChoiceKeys.Keys) { @@ -1096,7 +1096,7 @@ namespace System.Management.Automation.Internal.Host choicesSelected++; } // reset messageToBeDisplayed - messageToBeDisplayed = ""; + messageToBeDisplayed = string.Empty; } while (true); return result; diff --git a/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs index 9a23b9896..5bf3268e4 100644 --- a/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs @@ -121,7 +121,7 @@ namespace System.Management.Automation.Host /// public virtual void WriteLine() { - WriteLine(""); + WriteLine(string.Empty); } /// diff --git a/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs b/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs index fff7ab43d..8fc2b48d2 100644 --- a/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs +++ b/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs @@ -361,7 +361,7 @@ namespace Microsoft.PowerShell { long numberLangs = 0; int bufferSize = 0; - string returnval = ""; + string returnval = string.Empty; if (filterOutNonConsoleCultures) { diff --git a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs index 51cc2b38d..490ae3803 100644 --- a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs +++ b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs @@ -2161,7 +2161,7 @@ namespace System.Management.Automation if (Commands.Commands.Count == 0 && invokeMustRun) { - Commands.Commands.AddScript(""); + Commands.Commands.AddScript(string.Empty); } if (Commands.Commands.Count > 0) diff --git a/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs b/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs index cb4a29eba..c6eb5feeb 100644 --- a/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs +++ b/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs @@ -53,7 +53,7 @@ namespace System.Management.Automation.Interpreter public override string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - return ToString() + (_offset != Unknown ? " -> " + (instructionIndex + _offset) : ""); + return ToString() + (_offset != Unknown ? " -> " + (instructionIndex + _offset) : string.Empty); } public override string ToString() @@ -216,7 +216,7 @@ namespace System.Management.Automation.Interpreter { Debug.Assert(_labelIndex != UnknownInstrIndex); int targetIndex = labelIndexer(_labelIndex); - return ToString() + (targetIndex != BranchLabel.UnknownIndex ? " -> " + targetIndex : ""); + return ToString() + (targetIndex != BranchLabel.UnknownIndex ? " -> " + targetIndex : string.Empty); } public override string ToString() diff --git a/src/System.Management.Automation/engine/interpreter/Instruction.cs b/src/System.Management.Automation/engine/interpreter/Instruction.cs index a49e9b5f6..730c26ff5 100644 --- a/src/System.Management.Automation/engine/interpreter/Instruction.cs +++ b/src/System.Management.Automation/engine/interpreter/Instruction.cs @@ -45,7 +45,7 @@ namespace System.Management.Automation.Interpreter public virtual string InstructionName { - get { return GetType().Name.Replace("Instruction", ""); } + get { return GetType().Name.Replace("Instruction", string.Empty); } } public override string ToString() diff --git a/src/System.Management.Automation/engine/interpreter/InstructionList.cs b/src/System.Management.Automation/engine/interpreter/InstructionList.cs index ec2329d12..e6542a9bf 100644 --- a/src/System.Management.Automation/engine/interpreter/InstructionList.cs +++ b/src/System.Management.Automation/engine/interpreter/InstructionList.cs @@ -166,8 +166,8 @@ namespace System.Management.Automation.Interpreter internal string GetName() { return _index + - (_continuationsDepth == 0 ? "" : " C(" + _continuationsDepth + ")") + - (_stackDepth == 0 ? "" : " S(" + _stackDepth + ")"); + (_continuationsDepth == 0 ? string.Empty : " C(" + _continuationsDepth + ")") + + (_stackDepth == 0 ? string.Empty : " S(" + _stackDepth + ")"); } internal string GetValue() diff --git a/src/System.Management.Automation/engine/lang/parserutils.cs b/src/System.Management.Automation/engine/lang/parserutils.cs index 50e22f3f0..658608b75 100644 --- a/src/System.Management.Automation/engine/lang/parserutils.cs +++ b/src/System.Management.Automation/engine/lang/parserutils.cs @@ -104,7 +104,7 @@ namespace System.Management.Automation { internal LoopFlowException(string label) { - this.Label = label ?? ""; + this.Label = label ?? string.Empty; } internal LoopFlowException(SerializationInfo info, StreamingContext context) @@ -680,7 +680,7 @@ namespace System.Management.Automation } else { - split.Add(""); + split.Add(string.Empty); } break; } @@ -690,7 +690,7 @@ namespace System.Management.Automation // it. if (strIndex == (item.Length - 1)) { - split.Add(""); + split.Add(string.Empty); } } else @@ -764,7 +764,7 @@ namespace System.Management.Automation /// The result of the operator internal static object UnaryJoinOperator(ExecutionContext context, IScriptExtent errorPosition, object lval) { - return JoinOperator(context, errorPosition, lval, ""); + return JoinOperator(context, errorPosition, lval, string.Empty); } /// @@ -889,8 +889,8 @@ namespace System.Management.Automation /// The result of the operator internal static object ReplaceOperator(ExecutionContext context, IScriptExtent errorPosition, object lval, object rval, bool ignoreCase) { - object pattern = ""; - object substitute = ""; + object pattern = string.Empty; + object substitute = string.Empty; rval = PSObject.Base(rval); IList rList = rval as IList; diff --git a/src/System.Management.Automation/engine/parser/Compiler.cs b/src/System.Management.Automation/engine/parser/Compiler.cs index 0f7233c5b..3426d326a 100644 --- a/src/System.Management.Automation/engine/parser/Compiler.cs +++ b/src/System.Management.Automation/engine/parser/Compiler.cs @@ -531,7 +531,7 @@ namespace System.Management.Automation.Language internal static readonly Expression NullType = Expression.Constant(null, typeof(Type)); internal static readonly Expression NullDelegateArray = Expression.Constant(null, typeof(Action[])); internal static readonly Expression NullPipe = Expression.Constant(new Pipe { NullPipe = true }); - internal static readonly Expression ConstEmptyString = Expression.Constant(""); + internal static readonly Expression ConstEmptyString = Expression.Constant(string.Empty); internal static readonly Expression CompareOptionsIgnoreCase = Expression.Constant(CompareOptions.IgnoreCase); internal static readonly Expression CompareOptionsNone = Expression.Constant(CompareOptions.None); internal static readonly Expression Ordinal = Expression.Constant(StringComparison.Ordinal); @@ -3964,7 +3964,7 @@ namespace System.Management.Automation.Language Expression.IfThenElse( Expression.Call(breakExceptionVar, CachedReflectionInfo.LoopFlowException_MatchLabel, - Expression.Constant(label ?? "", typeof(string))), + Expression.Constant(label ?? string.Empty, typeof(string))), Expression.Break(breakLabel), Expression.Rethrow())), @@ -3973,7 +3973,7 @@ namespace System.Management.Automation.Language Expression.IfThenElse( Expression.Call(continueExceptionVar, CachedReflectionInfo.LoopFlowException_MatchLabel, - Expression.Constant(label ?? "", typeof(string))), + Expression.Constant(label ?? string.Empty, typeof(string))), Expression.Continue(continueLabel), Expression.Rethrow())) }; @@ -4041,7 +4041,7 @@ namespace System.Management.Automation.Language var loopBodyExprs = new List(); loopBodyExprs.Add(s_callCheckForInterrupts); - _loopTargets.Add(new LoopGotoTargets(loopLabel ?? "", breakLabel, continueLabel)); + _loopTargets.Add(new LoopGotoTargets(loopLabel ?? string.Empty, breakLabel, continueLabel)); _generatingWhileOrDoLoop = true; generateLoopBody(loopBodyExprs, breakLabel, continueLabel); _generatingWhileOrDoLoop = false; @@ -4120,7 +4120,7 @@ namespace System.Management.Automation.Language exprs.Add(Expression.Label(repeatLabel)); exprs.Add(enterLoopExpression); - _loopTargets.Add(new LoopGotoTargets(loopLabel ?? "", breakLabel, continueLabel)); + _loopTargets.Add(new LoopGotoTargets(loopLabel ?? string.Empty, breakLabel, continueLabel)); _generatingWhileOrDoLoop = true; var loopBodyExprs = new List { diff --git a/src/System.Management.Automation/engine/parser/DebugViewWriter.cs b/src/System.Management.Automation/engine/parser/DebugViewWriter.cs index edc91ebdf..0e462e051 100644 --- a/src/System.Management.Automation/engine/parser/DebugViewWriter.cs +++ b/src/System.Management.Automation/engine/parser/DebugViewWriter.cs @@ -1001,7 +1001,7 @@ namespace System.Management.Automation.Language { Dedent(); Out(Flow.NewLine, "}"); if (node.BreakLabel != null) { - Out("", Flow.NewLine); + Out(string.Empty, Flow.NewLine); DumpLabel(node.BreakLabel); } return node; @@ -1040,7 +1040,7 @@ namespace System.Management.Automation.Language { protected override CatchBlock VisitCatchBlock(CatchBlock node) { Out(Flow.NewLine, "} .Catch (" + node.Test.ToString()); if (node.Variable != null) { - Out(Flow.Space, ""); + Out(Flow.Space, string.Empty); VisitParameter(node.Variable); } if (node.Filter != null) { diff --git a/src/System.Management.Automation/engine/parser/Position.cs b/src/System.Management.Automation/engine/parser/Position.cs index 445f55490..c5e18b313 100644 --- a/src/System.Management.Automation/engine/parser/Position.cs +++ b/src/System.Management.Automation/engine/parser/Position.cs @@ -130,7 +130,7 @@ namespace System.Management.Automation.Language { if (PositionUtilities.EmptyExtent.Equals(position)) { - return ""; + return string.Empty; } string fileName = position.File; @@ -141,7 +141,7 @@ namespace System.Management.Automation.Language string sourceLine = position.StartScriptPosition.Line.TrimEnd(); - string message = ""; + string message = string.Empty; if (!String.IsNullOrEmpty(sourceLine)) { int spacesBeforeError = position.StartColumnNumber - 1; @@ -485,7 +485,7 @@ namespace System.Management.Automation.Language // StartOffset can be > the length for the EOF token. if (StartOffset > PositionHelper.ScriptText.Length) { - return ""; + return string.Empty; } return PositionHelper.ScriptText.Substring(StartOffset, EndOffset - StartOffset); } @@ -511,7 +511,7 @@ namespace System.Management.Automation.Language public int LineNumber { get { return 0; } } public int ColumnNumber { get { return 0; } } public int Offset { get { return 0; } } - public string Line { get { return ""; } } + public string Line { get { return string.Empty; } } public string GetFullScript() { return null; } } @@ -526,7 +526,7 @@ namespace System.Management.Automation.Language public int EndColumnNumber { get { return 0; } } public int StartOffset { get { return 0; } } public int EndOffset { get { return 0; } } - public string Text { get { return ""; } } + public string Text { get { return string.Empty; } } public override bool Equals(object obj) { diff --git a/src/System.Management.Automation/engine/parser/SemanticChecks.cs b/src/System.Management.Automation/engine/parser/SemanticChecks.cs index fd806af2e..0e59989d1 100644 --- a/src/System.Management.Automation/engine/parser/SemanticChecks.cs +++ b/src/System.Management.Automation/engine/parser/SemanticChecks.cs @@ -590,7 +590,7 @@ namespace System.Management.Automation.Language var loop = parent as LoopStatementAst; if (loop != null) { - if (LoopFlowException.MatchLoopLabel(label, loop.Label ?? "")) + if (LoopFlowException.MatchLoopLabel(label, loop.Label ?? string.Empty)) break; } } @@ -621,7 +621,7 @@ namespace System.Management.Automation.Language // of the finally. if (label != null && parent is LoopStatementAst) { - if (LoopFlowException.MatchLoopLabel(label, ((LoopStatementAst)parent).Label ?? "")) + if (LoopFlowException.MatchLoopLabel(label, ((LoopStatementAst)parent).Label ?? string.Empty)) break; } @@ -646,7 +646,7 @@ namespace System.Management.Automation.Language // we just use the empty string. if (expr == null) { - return ""; + return string.Empty; } var str = expr as StringConstantExpressionAst; diff --git a/src/System.Management.Automation/engine/parser/VariableAnalysis.cs b/src/System.Management.Automation/engine/parser/VariableAnalysis.cs index 186f32abf..aaef8dd0a 100644 --- a/src/System.Management.Automation/engine/parser/VariableAnalysis.cs +++ b/src/System.Management.Automation/engine/parser/VariableAnalysis.cs @@ -1172,7 +1172,7 @@ namespace System.Management.Automation.Language _currentBlock.FlowsTo(breakBlock); } - _loopTargets.Add(new LoopGotoTargets(loopLabel ?? "", breakBlock, continueBlock)); + _loopTargets.Add(new LoopGotoTargets(loopLabel ?? string.Empty, breakBlock, continueBlock)); _currentBlock.FlowsTo(bodyBlock); _currentBlock = bodyBlock; generateLoopBody(); @@ -1202,7 +1202,7 @@ namespace System.Management.Automation.Language var breakBlock = new Block(); var gotoRepeatTargetBlock = new Block(); - _loopTargets.Add(new LoopGotoTargets(loopStatement.Label ?? "", breakBlock, continueBlock)); + _loopTargets.Add(new LoopGotoTargets(loopStatement.Label ?? string.Empty, breakBlock, continueBlock)); _currentBlock.FlowsTo(bodyBlock); _currentBlock = bodyBlock; diff --git a/src/System.Management.Automation/engine/parser/ast.cs b/src/System.Management.Automation/engine/parser/ast.cs index 7117dfa7c..46cf2d9da 100644 --- a/src/System.Management.Automation/engine/parser/ast.cs +++ b/src/System.Management.Automation/engine/parser/ast.cs @@ -3613,7 +3613,7 @@ namespace System.Management.Automation.Language } var sb = new StringBuilder("param("); - string separator = ""; + string separator = string.Empty; if (additionalNewUsingParams != null) { diff --git a/src/System.Management.Automation/engine/parser/token.cs b/src/System.Management.Automation/engine/parser/token.cs index 76a8a1f52..5cc419f47 100644 --- a/src/System.Management.Automation/engine/parser/token.cs +++ b/src/System.Management.Automation/engine/parser/token.cs @@ -1045,25 +1045,25 @@ namespace System.Management.Automation.Language /* Shl */ "-shl", /* Shr */ "-shr", /* Colon */ ":", - /* Reserved slot 2 */ "", - /* Reserved slot 3 */ "", - /* Reserved slot 4 */ "", - /* Reserved slot 5 */ "", - /* Reserved slot 6 */ "", - /* Reserved slot 7 */ "", - /* Reserved slot 8 */ "", - /* Reserved slot 9 */ "", - /* Reserved slot 10 */ "", - /* Reserved slot 11 */ "", - /* Reserved slot 12 */ "", - /* Reserved slot 13 */ "", - /* Reserved slot 14 */ "", - /* Reserved slot 15 */ "", - /* Reserved slot 16 */ "", - /* Reserved slot 17 */ "", - /* Reserved slot 18 */ "", - /* Reserved slot 19 */ "", - /* Reserved slot 20 */ "", + /* Reserved slot 2 */ string.Empty, + /* Reserved slot 3 */ string.Empty, + /* Reserved slot 4 */ string.Empty, + /* Reserved slot 5 */ string.Empty, + /* Reserved slot 6 */ string.Empty, + /* Reserved slot 7 */ string.Empty, + /* Reserved slot 8 */ string.Empty, + /* Reserved slot 9 */ string.Empty, + /* Reserved slot 10 */ string.Empty, + /* Reserved slot 11 */ string.Empty, + /* Reserved slot 12 */ string.Empty, + /* Reserved slot 13 */ string.Empty, + /* Reserved slot 14 */ string.Empty, + /* Reserved slot 15 */ string.Empty, + /* Reserved slot 16 */ string.Empty, + /* Reserved slot 17 */ string.Empty, + /* Reserved slot 18 */ string.Empty, + /* Reserved slot 19 */ string.Empty, + /* Reserved slot 20 */ string.Empty, #endregion Text for operators @@ -1298,7 +1298,7 @@ namespace System.Management.Automation.Language internal override string ToDebugString(int indent) { return string.Format(CultureInfo.InvariantCulture, - "{0}{1}: <-{2}{3}>", StringUtil.Padding(indent), Kind, _parameterName, _usedColon ? ":" : ""); + "{0}{1}: <-{2}{3}>", StringUtil.Padding(indent), Kind, _parameterName, _usedColon ? ":" : string.Empty); } } diff --git a/src/System.Management.Automation/engine/parser/tokenizer.cs b/src/System.Management.Automation/engine/parser/tokenizer.cs index 695682932..9011961e6 100644 --- a/src/System.Management.Automation/engine/parser/tokenizer.cs +++ b/src/System.Management.Automation/engine/parser/tokenizer.cs @@ -2421,7 +2421,7 @@ namespace System.Management.Automation.Language if (!ScanAfterHereStringHeader("@'")) { - return NewStringLiteralToken("", TokenKind.HereStringLiteral, TokenFlags.TokenInError); + return NewStringLiteralToken(string.Empty, TokenKind.HereStringLiteral, TokenFlags.TokenInError); } TokenFlags flags = TokenFlags.None; @@ -2489,7 +2489,7 @@ namespace System.Management.Automation.Language if (!ScanAfterHereStringHeader("@\"")) { - return NewStringExpandableToken("", "", TokenKind.HereStringExpandable, null, TokenFlags.TokenInError); + return NewStringExpandableToken(string.Empty, string.Empty, TokenKind.HereStringExpandable, null, TokenFlags.TokenInError); } TokenFlags flags = TokenFlags.None; diff --git a/src/System.Management.Automation/engine/pipeline.cs b/src/System.Management.Automation/engine/pipeline.cs index 787a925e2..108b47c3c 100644 --- a/src/System.Management.Automation/engine/pipeline.cs +++ b/src/System.Management.Automation/engine/pipeline.cs @@ -174,14 +174,14 @@ namespace System.Management.Automation.Internal private string GetCommand(InvocationInfo invocationInfo) { if (invocationInfo == null) - return ""; + return string.Empty; if (invocationInfo.MyCommand != null) { return invocationInfo.MyCommand.Name; } - return ""; + return string.Empty; } private string GetCommand(Exception exception) @@ -190,7 +190,7 @@ namespace System.Management.Automation.Internal if (null != icer && null != icer.ErrorRecord) return GetCommand(icer.ErrorRecord.InvocationInfo); - return ""; + return string.Empty; } private void Log(string logElement, InvocationInfo invocation, PipelineExecutionStatus pipelineExecutionStatus) diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index 9b512a7c6..a9662cc24 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -1541,7 +1541,7 @@ namespace System.Management.Automation internal void CloseAllStreams() { // The Complete() method includes raising public notification events that third parties can - // handle and potentially throw exceptions on the notification thread. We don't want to + // handle and potentially throw exceptions on the notification thread. We don't want to // propagate those exceptions because it prevents this thread from completing its processing. if (_resultsOwner) { try { _results.Complete(); } catch (Exception e) { TraceException(e); } } if (_outputOwner) { try { _output.Complete(); } catch (Exception e) { TraceException(e); } } @@ -2852,7 +2852,7 @@ namespace System.Management.Automation get { //ISSUE implement this. - return ""; + return string.Empty; } } diff --git a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs index b8f8e3803..23a5e7988 100644 --- a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs +++ b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs @@ -1507,7 +1507,7 @@ namespace System.Management.Automation.Runspaces.Internal { if (timeString != null) { - string timeoutString = timeString.Replace("PT", "").Replace("S", ""); + string timeoutString = timeString.Replace("PT", string.Empty).Replace("S", string.Empty); try { // Convert time from seconds to milliseconds. diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index cc579aa6a..d178a9698 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -1133,7 +1133,7 @@ else } } - string securityParameters = ""; + string securityParameters = string.Empty; if (!string.IsNullOrEmpty(sddl)) { securityParameters = string.Format(CultureInfo.InvariantCulture, diff --git a/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs b/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs index 5e5bce96e..e709caa1c 100644 --- a/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs +++ b/src/System.Management.Automation/engine/remoting/commands/NewPSSessionConfigurationFile.cs @@ -1844,7 +1844,7 @@ namespace Microsoft.PowerShell.Commands foreach (var key in keys) { sb.Append(writer.NewLine); - sb.AppendFormat("{0," + (4 * (indent + 1)) + "}", ""); + sb.AppendFormat("{0," + (4 * (indent + 1)) + "}", string.Empty); sb.Append(QuoteName(key)); sb.Append(" = "); if ((table[key] as ScriptBlock) != null) diff --git a/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs b/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs index 8c9c6b6e1..a95d77628 100644 --- a/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs +++ b/src/System.Management.Automation/engine/remoting/commands/ReceivePSSession.cs @@ -808,7 +808,7 @@ namespace Microsoft.PowerShell.Commands { WriteWarning( GetMessage(RemotingErrorIdStrings.ReceivePSSessionInDebugMode)); - WriteObject(""); + WriteObject(string.Empty); } /// diff --git a/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs b/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs index 37baa925b..fc027aebd 100644 --- a/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs +++ b/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs @@ -102,7 +102,7 @@ namespace System.Management.Automation.Remoting private static string CleanAppDomainNameForPipeName(string appDomainName) { // Pipe names cannot contain the ':' character. Remove unwanted characters. - return appDomainName.Replace(":", "").Replace(" ", ""); + return appDomainName.Replace(":", string.Empty).Replace(" ", string.Empty); } /// diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs index 5047bb1b2..b43631e82 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs @@ -2421,7 +2421,7 @@ namespace System.Management.Automation.Remoting.Client // The error code taken from winerror.h used for getting buffer length. const int ERROR_INSUFFICIENT_BUFFER = 122; - string returnval = ""; + string returnval = string.Empty; int bufferSize = 0; // calculate buffer size required if (ERROR_INSUFFICIENT_BUFFER != WSManGetSessionOptionAsString(wsManAPIHandle, @@ -2774,7 +2774,7 @@ namespace System.Management.Automation.Remoting.Client // get language code. string langCode = CultureInfo.CurrentUICulture.Name; - string returnval = ""; + string returnval = string.Empty; int bufferSize = 0; // calculate buffer size required if (ERROR_INSUFFICIENT_BUFFER != WSManGetErrorMessage(wsManAPIHandle, diff --git a/src/System.Management.Automation/engine/remoting/server/OutOfProcServerMediator.cs b/src/System.Management.Automation/engine/remoting/server/OutOfProcServerMediator.cs index f6bb4c6c9..29d192139 100644 --- a/src/System.Management.Automation/engine/remoting/server/OutOfProcServerMediator.cs +++ b/src/System.Management.Automation/engine/remoting/server/OutOfProcServerMediator.cs @@ -300,11 +300,11 @@ namespace System.Management.Automation.Remoting.Server PSSenderInfo senderInfo; #if !UNIX WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent(); - PSPrincipal userPrincipal = new PSPrincipal(new PSIdentity("", true, currentIdentity.Name, null), + PSPrincipal userPrincipal = new PSPrincipal(new PSIdentity(string.Empty, true, currentIdentity.Name, null), currentIdentity); senderInfo = new PSSenderInfo(userPrincipal, "http://localhost"); #else - PSPrincipal userPrincipal = new PSPrincipal(new PSIdentity("", true, "", null), + PSPrincipal userPrincipal = new PSPrincipal(new PSIdentity(string.Empty, true, string.Empty, null), null); senderInfo = new PSSenderInfo(userPrincipal, "http://localhost"); #endif diff --git a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs index 02d0a6496..caf3b86d1 100644 --- a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs +++ b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs @@ -237,7 +237,7 @@ namespace System.Management.Automation.Remoting string configurationName) { ServerRemoteSession result = CreateServerRemoteSession(senderInfo, - "Microsoft.PowerShell", "", transportManager, configurationName); + "Microsoft.PowerShell", string.Empty, transportManager, configurationName); result._initScriptForOutOfProcRS = initializationScriptForOutOfProcessRunspace; return result; } diff --git a/src/System.Management.Automation/engine/runtime/Binding/Binders.cs b/src/System.Management.Automation/engine/runtime/Binding/Binders.cs index a750f966e..4f55eafa3 100644 --- a/src/System.Management.Automation/engine/runtime/Binding/Binders.cs +++ b/src/System.Management.Automation/engine/runtime/Binding/Binders.cs @@ -2194,7 +2194,7 @@ namespace System.Management.Automation.Language public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "PSBinaryOperationBinder {0}{1} ver:{2}", GetOperatorText(), _scalarCompare ? " scalarOnly" : "", _version); + return string.Format(CultureInfo.InvariantCulture, "PSBinaryOperationBinder {0}{1} ver:{2}", GetOperatorText(), _scalarCompare ? " scalarOnly" : string.Empty, _version); } internal static void InvalidateCache() @@ -2231,7 +2231,7 @@ namespace System.Management.Automation.Language case ExpressionType.RightShift: return TokenKind.Shr.Text(); } Diagnostics.Assert(false, "Unexpected operator"); - return ""; + return string.Empty; } private static DynamicMetaObject CallImplicitOp(string methodName, DynamicMetaObject target, DynamicMetaObject arg, string errorOperator, DynamicMetaObject errorSuggestion) @@ -3862,8 +3862,8 @@ namespace System.Management.Automation.Language return string.Format(CultureInfo.InvariantCulture, "PSGetIndexBinder indexCount={0}{1}{2} ver:{3}", this.CallInfo.ArgumentCount, - _allowSlicing ? "" : " slicing disallowed", - _constraints == null ? "" : " constraints: " + _constraints, + _allowSlicing ? string.Empty : " slicing disallowed", + _constraints == null ? string.Empty : " constraints: " + _constraints, _version); } @@ -4388,7 +4388,7 @@ namespace System.Management.Automation.Language public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "PSSetIndexBinder indexCnt={0}{1} ver:{2}", - CallInfo.ArgumentCount, _constraints == null ? "" : " constraints: " + _constraints, _version); + CallInfo.ArgumentCount, _constraints == null ? string.Empty : " constraints: " + _constraints, _version); } internal static void InvalidateCache() @@ -4974,7 +4974,7 @@ namespace System.Management.Automation.Language public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "GetMember: {0}{1}{2} ver:{3}", - Name, _static ? " static" : "", _nonEnumerating ? " nonEnumerating" : "", _version); + Name, _static ? " static" : string.Empty, _nonEnumerating ? " nonEnumerating" : string.Empty, _version); } public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion) @@ -5815,7 +5815,7 @@ namespace System.Management.Automation.Language public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "SetMember: {0}{1} ver:{2}", _static ? "static " : "", Name, _getMemberBinder._version); + return string.Format(CultureInfo.InvariantCulture, "SetMember: {0}{1} ver:{2}", _static ? "static " : string.Empty, Name, _getMemberBinder._version); } private Expression GetTransformedExpression(IEnumerable transformationAttributes, Expression originalExpression) @@ -6364,8 +6364,8 @@ namespace System.Management.Automation.Language public override string ToString() { return string.Format(CultureInfo.InvariantCulture, - "PSInvokeMember: {0}{1}{2} ver:{3} args:{4} constraints:<{5}>", _static ? "static " : "", _propertySetter ? "propset " : "", - Name, _getMemberBinder._version, CallInfo.ArgumentCount, _invocationConstraints != null ? _invocationConstraints.ToString() : ""); + "PSInvokeMember: {0}{1}{2} ver:{3} args:{4} constraints:<{5}>", _static ? "static " : string.Empty, _propertySetter ? "propset " : string.Empty, + Name, _getMemberBinder._version, CallInfo.ArgumentCount, _invocationConstraints != null ? _invocationConstraints.ToString() : string.Empty); } public override DynamicMetaObject FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) @@ -7241,7 +7241,7 @@ namespace System.Management.Automation.Language public override string ToString() { return string.Format(CultureInfo.InvariantCulture, - "PSCreateInstanceBinder: ver:{0} args:{1} constraints:<{2}>", _version, _callInfo.ArgumentCount, _constraints != null ? _constraints.ToString() : ""); + "PSCreateInstanceBinder: ver:{0} args:{1} constraints:<{2}>", _version, _callInfo.ArgumentCount, _constraints != null ? _constraints.ToString() : string.Empty); } public override DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) diff --git a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs index a586a5cff..47e7c3ff2 100644 --- a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs +++ b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs @@ -356,7 +356,7 @@ namespace System.Management.Automation { if (_parameterMetadata == null) { - CommandMetadata metadata = new CommandMetadata(scriptBlock, "", LocalPipeline.GetExecutionContextFromTLS()); + CommandMetadata metadata = new CommandMetadata(scriptBlock, string.Empty, LocalPipeline.GetExecutionContextFromTLS()); _parameterMetadata = metadata.StaticCommandParameterMetadata; } } @@ -503,7 +503,7 @@ namespace System.Management.Automation s_cachedScripts.Clear(); } - internal static ScriptBlock EmptyScriptBlock = ScriptBlock.CreateDelayParsedScriptBlock("", isProductCode: true); + internal static ScriptBlock EmptyScriptBlock = ScriptBlock.CreateDelayParsedScriptBlock(string.Empty, isProductCode: true); internal static ScriptBlock Create(Parser parser, string fileName, string fileContents) { diff --git a/src/System.Management.Automation/engine/runtime/ScriptBlockToPowerShell.cs b/src/System.Management.Automation/engine/runtime/ScriptBlockToPowerShell.cs index c9888d110..1e35eadf6 100644 --- a/src/System.Management.Automation/engine/runtime/ScriptBlockToPowerShell.cs +++ b/src/System.Management.Automation/engine/runtime/ScriptBlockToPowerShell.cs @@ -780,7 +780,7 @@ namespace System.Management.Automation } else { - nameSuffix = ""; + nameSuffix = string.Empty; argument = null; } diff --git a/src/System.Management.Automation/help/AliasHelpInfo.cs b/src/System.Management.Automation/help/AliasHelpInfo.cs index debc0a575..c6e6dc5be 100644 --- a/src/System.Management.Automation/help/AliasHelpInfo.cs +++ b/src/System.Management.Automation/help/AliasHelpInfo.cs @@ -51,13 +51,13 @@ namespace System.Management.Automation /// Returns the name of alias help. /// /// Name of alias help. - internal override string Name { get; } = ""; + internal override string Name { get; } = string.Empty; /// /// Returns synopsis of alias help. /// /// Synopsis of alias help. - internal override string Synopsis { get; } = ""; + internal override string Synopsis { get; } = string.Empty; /// /// Help category for alias help. This is always HelpCategory.Alias diff --git a/src/System.Management.Automation/help/AliasHelpProvider.cs b/src/System.Management.Automation/help/AliasHelpProvider.cs index e98b13539..abdf6b867 100644 --- a/src/System.Management.Automation/help/AliasHelpProvider.cs +++ b/src/System.Management.Automation/help/AliasHelpProvider.cs @@ -311,7 +311,7 @@ namespace System.Management.Automation return true; if (String.IsNullOrEmpty(target)) - target = ""; + target = string.Empty; WildcardPattern matcher = WildcardPattern.Get(pattern, WildcardOptions.IgnoreCase); diff --git a/src/System.Management.Automation/help/BaseCommandHelpInfo.cs b/src/System.Management.Automation/help/BaseCommandHelpInfo.cs index f2d67f192..658715a35 100644 --- a/src/System.Management.Automation/help/BaseCommandHelpInfo.cs +++ b/src/System.Management.Automation/help/BaseCommandHelpInfo.cs @@ -53,18 +53,18 @@ namespace System.Management.Automation PSObject commandDetails = this.Details; if (commandDetails == null) { - return ""; + return string.Empty; } if (commandDetails.Properties["Name"] == null || commandDetails.Properties["Name"].Value == null) { - return ""; + return string.Empty; } string name = commandDetails.Properties["Name"].Value.ToString(); if (name == null) - return ""; + return string.Empty; return name.Trim(); } @@ -81,13 +81,13 @@ namespace System.Management.Automation PSObject commandDetails = this.Details; if (commandDetails == null) { - return ""; + return string.Empty; } if (commandDetails.Properties["Description"] == null || commandDetails.Properties["Description"].Value == null) { - return ""; + return string.Empty; } object[] synopsisItems = (object[])LanguagePrimitives.ConvertTo( @@ -96,7 +96,7 @@ namespace System.Management.Automation CultureInfo.InvariantCulture); if (synopsisItems == null || synopsisItems.Length == 0) { - return ""; + return string.Empty; } PSObject firstSynopsisItem = synopsisItems[0] == null ? null : PSObject.AsPSObject(synopsisItems[0]); @@ -104,13 +104,13 @@ namespace System.Management.Automation firstSynopsisItem.Properties["Text"] == null || firstSynopsisItem.Properties["Text"].Value == null) { - return ""; + return string.Empty; } string synopsis = firstSynopsisItem.Properties["Text"].Value.ToString(); if (synopsis == null) { - return ""; + return string.Empty; } return synopsis.Trim(); @@ -434,12 +434,12 @@ namespace System.Management.Automation get { if (this.FullHelp == null) - return ""; + return string.Empty; if (this.FullHelp.Properties["Description"] == null || this.FullHelp.Properties["Description"].Value == null) { - return ""; + return string.Empty; } object[] descriptionItems = (object[])LanguagePrimitives.ConvertTo( @@ -448,7 +448,7 @@ namespace System.Management.Automation CultureInfo.InvariantCulture); if (descriptionItems == null || descriptionItems.Length == 0) { - return ""; + return string.Empty; } // I think every cmdlet description should atleast have 400 characters... diff --git a/src/System.Management.Automation/help/CommandHelpProvider.cs b/src/System.Management.Automation/help/CommandHelpProvider.cs index 23be0ce9c..6e9b66990 100644 --- a/src/System.Management.Automation/help/CommandHelpProvider.cs +++ b/src/System.Management.Automation/help/CommandHelpProvider.cs @@ -595,7 +595,7 @@ namespace System.Management.Automation // Actual help file name: Microsoft.PowerShell.Commands.Management.dll-Help.xml // Make sure that the assembly name contains more than '.ni.dll' - string assemblyName = helpFile.Replace(".ni.dll-Help.xml", ""); + string assemblyName = helpFile.Replace(".ni.dll-Help.xml", string.Empty); if (!String.IsNullOrEmpty(assemblyName)) { @@ -1195,7 +1195,7 @@ namespace System.Management.Automation return true; if (String.IsNullOrEmpty(target)) - target = ""; + target = string.Empty; WildcardPattern matcher = WildcardPattern.Get(pattern, WildcardOptions.IgnoreCase); diff --git a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs index 130127c48..03e5c8c32 100644 --- a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs +++ b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs @@ -419,13 +419,13 @@ namespace System.Management.Automation.Help if (attribs.Count == 0) { - obj.Properties.Add(new PSNoteProperty("required", "")); - obj.Properties.Add(new PSNoteProperty("pipelineInput", "")); - obj.Properties.Add(new PSNoteProperty("isDynamic", "")); - obj.Properties.Add(new PSNoteProperty("parameterSetName", "")); - obj.Properties.Add(new PSNoteProperty("description", "")); - obj.Properties.Add(new PSNoteProperty("position", "")); - obj.Properties.Add(new PSNoteProperty("aliases", "")); + obj.Properties.Add(new PSNoteProperty("required", string.Empty)); + obj.Properties.Add(new PSNoteProperty("pipelineInput", string.Empty)); + obj.Properties.Add(new PSNoteProperty("isDynamic", string.Empty)); + obj.Properties.Add(new PSNoteProperty("parameterSetName", string.Empty)); + obj.Properties.Add(new PSNoteProperty("description", string.Empty)); + obj.Properties.Add(new PSNoteProperty("position", string.Empty)); + obj.Properties.Add(new PSNoteProperty("aliases", string.Empty)); } else { diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index 2015d3466..2ee616f42 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -51,7 +51,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(Position = 0, ValueFromPipelineByPropertyName = true)] [ValidateNotNullOrEmpty()] - public string Name { get; set; } = ""; + public string Name { get; set; } = string.Empty; /// /// Path to provider location that user is curious about. @@ -89,7 +89,7 @@ namespace Microsoft.PowerShell.Commands [Parameter] public string[] Role { get; set; } = null; - private string _provider = ""; + private string _provider = string.Empty; /// /// Changes the view of HelpObject returned diff --git a/src/System.Management.Automation/help/HelpCommentsParser.cs b/src/System.Management.Automation/help/HelpCommentsParser.cs index 0e0c71750..196233aee 100644 --- a/src/System.Management.Automation/help/HelpCommentsParser.cs +++ b/src/System.Management.Automation/help/HelpCommentsParser.cs @@ -283,7 +283,7 @@ namespace System.Management.Automation var compiledAttributes = parameter.CompiledAttributes; bool supportsWildcards = compiledAttributes.OfType().Any(); - string defaultValueStr = ""; + string defaultValueStr = string.Empty; object defaultValue = null; var defaultValueAttribute = compiledAttributes.OfType().FirstOrDefault(); if (defaultValueAttribute != null) @@ -469,7 +469,7 @@ namespace System.Management.Automation parameterSetData.IsMandatory, parameterSetData.ValueFromPipeline, parameterSetData.ValueFromPipelineByPropertyName, parameterSetData.IsPositional ? (1 + parameterSetData.Position).ToString(CultureInfo.InvariantCulture) : "named", - parameter.Type, description, supportsWildcards, defaultValue: "", forSyntax: true); + parameter.Type, description, supportsWildcards, defaultValue: string.Empty, forSyntax: true); syntaxItem.AppendChild(parameterElement); } command.AppendChild(syntax).AppendChild(syntaxItem); @@ -477,7 +477,7 @@ namespace System.Management.Automation private static void GetExampleSections(string content, out string prompt_str, out string code_str, out string remarks_str) { - prompt_str = code_str = ""; + prompt_str = code_str = string.Empty; StringBuilder builder = new StringBuilder(); int collectingPart = 1; @@ -509,7 +509,7 @@ namespace System.Management.Automation { prompt_str = "PS C:\\>"; code_str = builder.ToString().Trim(); - remarks_str = ""; + remarks_str = string.Empty; } else { diff --git a/src/System.Management.Automation/help/HelpErrorTracer.cs b/src/System.Management.Automation/help/HelpErrorTracer.cs index 9e68fba17..e16d0076f 100644 --- a/src/System.Management.Automation/help/HelpErrorTracer.cs +++ b/src/System.Management.Automation/help/HelpErrorTracer.cs @@ -54,7 +54,7 @@ namespace System.Management.Automation internal sealed class TraceFrame : IDisposable { // Following are help context information - private string _helpFile = ""; + private string _helpFile = string.Empty; // ErrorRecords accumulated during the help content loading. private Collection _errors = new Collection(); diff --git a/src/System.Management.Automation/help/HelpFileHelpInfo.cs b/src/System.Management.Automation/help/HelpFileHelpInfo.cs index fe1338009..11df65b6c 100644 --- a/src/System.Management.Automation/help/HelpFileHelpInfo.cs +++ b/src/System.Management.Automation/help/HelpFileHelpInfo.cs @@ -40,7 +40,7 @@ namespace System.Management.Automation else { // make sure _synopsis is never null - _synopsis = ""; + _synopsis = string.Empty; } _filename = filename; @@ -50,10 +50,10 @@ namespace System.Management.Automation /// Name for the help info /// /// Name for the help info - internal override string Name { get; } = ""; + internal override string Name { get; } = string.Empty; - private string _filename = ""; - private string _synopsis = ""; + private string _filename = string.Empty; + private string _synopsis = string.Empty; /// /// Synopsis for the help info /// diff --git a/src/System.Management.Automation/help/HelpInfo.cs b/src/System.Management.Automation/help/HelpInfo.cs index d225d2276..f6f8c7e11 100644 --- a/src/System.Management.Automation/help/HelpInfo.cs +++ b/src/System.Management.Automation/help/HelpInfo.cs @@ -107,7 +107,7 @@ namespace System.Management.Automation /// alias. /// /// forward target object name - internal string ForwardTarget { get; set; } = ""; + internal string ForwardTarget { get; set; } = string.Empty; /// /// Full help object for this help item. diff --git a/src/System.Management.Automation/help/HelpNotFoundException.cs b/src/System.Management.Automation/help/HelpNotFoundException.cs index bf0cc48fc..3bb400119 100644 --- a/src/System.Management.Automation/help/HelpNotFoundException.cs +++ b/src/System.Management.Automation/help/HelpNotFoundException.cs @@ -77,7 +77,7 @@ namespace Microsoft.PowerShell.Commands } } - private string _helpTopic = ""; + private string _helpTopic = string.Empty; /// /// Gets help topic for which help is not found. diff --git a/src/System.Management.Automation/help/HelpSystem.cs b/src/System.Management.Automation/help/HelpSystem.cs index 92674f32d..a1cb3de7b 100644 --- a/src/System.Management.Automation/help/HelpSystem.cs +++ b/src/System.Management.Automation/help/HelpSystem.cs @@ -603,15 +603,15 @@ namespace System.Management.Automation // help providers using reflection. This is not in v1 right now. // private static HelpProviderInfo[] _providerInfos = new HelpProviderInfo[] - { new HelpProviderInfo("", "AliasHelpProvider", HelpCategory.Alias), - new HelpProviderInfo("", "CommandHelpProvider", HelpCategory.Command), - new HelpProviderInfo("", "ProviderHelpProvider", HelpCategory.Provider), - new HelpProviderInfo("", "OverviewHelpProvider", HelpCategory.Overview), - new HelpProviderInfo("", "GeneralHelpProvider", HelpCategory.General), - new HelpProviderInfo("", "FAQHelpProvider", HelpCategory.FAQ), - new HelpProviderInfo("", "GlossaryHelpProvider", HelpCategory.Glossary), - new HelpProviderInfo("", "HelpFileHelpProvider", HelpCategory.HelpFile), - new HelpProviderInfo("", "DefaultHelpHelpProvider", HelpCategory.DefaultHelp) + { new HelpProviderInfo(string.Empty, "AliasHelpProvider", HelpCategory.Alias), + new HelpProviderInfo(string.Empty, "CommandHelpProvider", HelpCategory.Command), + new HelpProviderInfo(string.Empty, "ProviderHelpProvider", HelpCategory.Provider), + new HelpProviderInfo(string.Empty, "OverviewHelpProvider", HelpCategory.Overview), + new HelpProviderInfo(string.Empty, "GeneralHelpProvider", HelpCategory.General), + new HelpProviderInfo(string.Empty, "FAQHelpProvider", HelpCategory.FAQ), + new HelpProviderInfo(string.Empty, "GlossaryHelpProvider", HelpCategory.Glossary), + new HelpProviderInfo(string.Empty, "HelpFileHelpProvider", HelpCategory.HelpFile), + new HelpProviderInfo(string.Empty, "DefaultHelpHelpProvider", HelpCategory.DefaultHelp) }; private void InitializeHelpProviders() @@ -818,8 +818,8 @@ namespace System.Management.Automation /// internal class HelpProviderInfo { - internal string AssemblyName = ""; - internal string ClassName = ""; + internal string AssemblyName = string.Empty; + internal string ClassName = string.Empty; internal HelpCategory HelpCategory = HelpCategory.None; /// diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs index 17f31ff25..d04f0b5bf 100644 --- a/src/System.Management.Automation/help/MUIFileSearcher.cs +++ b/src/System.Management.Automation/help/MUIFileSearcher.cs @@ -211,7 +211,7 @@ namespace System.Management.Automation cultureNameList.Add(culture.Name); culture = culture.Parent; } - cultureNameList.Add(""); + cultureNameList.Add(string.Empty); // Add en-US and en as fallback languages if (!cultureNameList.Contains("en-US")) diff --git a/src/System.Management.Automation/help/MamlNode.cs b/src/System.Management.Automation/help/MamlNode.cs index a63dd1654..539be02b7 100644 --- a/src/System.Management.Automation/help/MamlNode.cs +++ b/src/System.Management.Automation/help/MamlNode.cs @@ -701,7 +701,7 @@ namespace System.Management.Automation private static string GetNodePath(XmlNode xmlNode) { if (xmlNode == null) - return ""; + return string.Empty; if (xmlNode.ParentNode == null) return "\\" + xmlNode.LocalName; @@ -712,7 +712,7 @@ namespace System.Management.Automation private static string GetNodeIndex(XmlNode xmlNode) { if (xmlNode == null || xmlNode.ParentNode == null) - return ""; + return string.Empty; int index = 0; int total = 0; @@ -736,7 +736,7 @@ namespace System.Management.Automation return "[" + index.ToString("d", CultureInfo.CurrentCulture) + "]"; } - return ""; + return string.Empty; } /// @@ -884,7 +884,7 @@ namespace System.Management.Automation if (!xmlNode.LocalName.Equals("listItem", StringComparison.OrdinalIgnoreCase)) return null; - string text = ""; + string text = string.Empty; if (xmlNode.ChildNodes.Count > 1) { @@ -902,7 +902,7 @@ namespace System.Management.Automation WriteMamlInvalidChildNodeError(xmlNode, childNode); } - string tag = ""; + string tag = string.Empty; if (ordered) { tag = index.ToString("d2", CultureInfo.CurrentCulture); @@ -1051,14 +1051,14 @@ namespace System.Management.Automation return null; if (xmlNode.ChildNodes == null || xmlNode.ChildNodes.Count == 0) - return ""; + return string.Empty; if (xmlNode.ChildNodes.Count > 1) { WriteMamlInvalidChildNodeCountError(xmlNode, "para", 1); } - string text = ""; + string text = string.Empty; foreach (XmlNode childNode in xmlNode.ChildNodes) { @@ -1118,7 +1118,7 @@ namespace System.Management.Automation string[] trimedLines = TrimLines(lines); if (trimedLines == null || trimedLines.Length == 0) - return ""; + return string.Empty; int minIndentation = GetMinIndentation(trimedLines); diff --git a/src/System.Management.Automation/help/MamlUtil.cs b/src/System.Management.Automation/help/MamlUtil.cs index 7ddf46217..73a6a4f77 100644 --- a/src/System.Management.Automation/help/MamlUtil.cs +++ b/src/System.Management.Automation/help/MamlUtil.cs @@ -130,7 +130,7 @@ namespace System.Management.Automation for (int index = 0; index < maml2items.Count; index++) { PSObject m2paramObj = PSObject.AsPSObject(maml2items[index]); - string param2Name = ""; + string param2Name = string.Empty; PSPropertyInfo m2propertyInfo = m2paramObj.Properties["Name"]; if (null != m2propertyInfo) @@ -144,7 +144,7 @@ namespace System.Management.Automation bool isParamFoundInMaml1 = false; foreach (PSObject m1ParamObj in maml1items) { - string param1Name = ""; + string param1Name = string.Empty; PSPropertyInfo m1PropertyInfo = m1ParamObj.Properties["Name"]; if (null != m1PropertyInfo) diff --git a/src/System.Management.Automation/help/ProviderHelpInfo.cs b/src/System.Management.Automation/help/ProviderHelpInfo.cs index 1061eac0f..e543da313 100644 --- a/src/System.Management.Automation/help/ProviderHelpInfo.cs +++ b/src/System.Management.Automation/help/ProviderHelpInfo.cs @@ -39,17 +39,17 @@ namespace System.Management.Automation get { if (_fullHelpObject == null) - return ""; + return string.Empty; if (_fullHelpObject.Properties["Name"] == null) - return ""; + return string.Empty; if (_fullHelpObject.Properties["Name"].Value == null) - return ""; + return string.Empty; string name = _fullHelpObject.Properties["Name"].Value.ToString(); if (name == null) - return ""; + return string.Empty; return name.Trim(); } @@ -64,17 +64,17 @@ namespace System.Management.Automation get { if (_fullHelpObject == null) - return ""; + return string.Empty; if (_fullHelpObject.Properties["Synopsis"] == null) - return ""; + return string.Empty; if (_fullHelpObject.Properties["Synopsis"].Value == null) - return ""; + return string.Empty; string synopsis = _fullHelpObject.Properties["Synopsis"].Value.ToString(); if (synopsis == null) - return ""; + return string.Empty; return synopsis.Trim(); } @@ -89,18 +89,18 @@ namespace System.Management.Automation get { if (this.FullHelp == null) - return ""; + return string.Empty; if (this.FullHelp.Properties["DetailedDescription"] == null || this.FullHelp.Properties["DetailedDescription"].Value == null) { - return ""; + return string.Empty; } IList descriptionItems = FullHelp.Properties["DetailedDescription"].Value as IList; if (descriptionItems == null || descriptionItems.Count == 0) { - return ""; + return string.Empty; } // I think every provider description should atleast have 400 characters... diff --git a/src/System.Management.Automation/help/SyntaxHelpInfo.cs b/src/System.Management.Automation/help/SyntaxHelpInfo.cs index 44fc51b8d..6a5577000 100644 --- a/src/System.Management.Automation/help/SyntaxHelpInfo.cs +++ b/src/System.Management.Automation/help/SyntaxHelpInfo.cs @@ -26,13 +26,13 @@ namespace System.Management.Automation /// Name for the help info /// /// Name for the help info - internal override string Name { get; } = ""; + internal override string Name { get; } = string.Empty; /// /// Synopsis for the help info /// /// Synopsis for the help info - internal override string Synopsis { get; } = ""; + internal override string Synopsis { get; } = string.Empty; /// /// Full help object for this help info diff --git a/src/System.Management.Automation/help/UpdatableHelpSystem.cs b/src/System.Management.Automation/help/UpdatableHelpSystem.cs index 8e4990202..0a338b8bd 100644 --- a/src/System.Management.Automation/help/UpdatableHelpSystem.cs +++ b/src/System.Management.Automation/help/UpdatableHelpSystem.cs @@ -128,7 +128,7 @@ namespace System.Management.Automation.Help /// internal string GetExceptionMessage(UpdatableHelpCommandType commandType) { - string message = ""; + string message = string.Empty; SortedSet sortedModules = new SortedSet(Modules, StringComparer.CurrentCultureIgnoreCase); SortedSet sortedCultures = new SortedSet(Cultures, StringComparer.CurrentCultureIgnoreCase); string modules = String.Join(", ", sortedModules); diff --git a/src/System.Management.Automation/logging/LogContext.cs b/src/System.Management.Automation/logging/LogContext.cs index 7d9c3fe59..9290dccb4 100644 --- a/src/System.Management.Automation/logging/LogContext.cs +++ b/src/System.Management.Automation/logging/LogContext.cs @@ -15,13 +15,13 @@ namespace System.Management.Automation { #region Context Properties - internal String Severity { get; set; } = ""; + internal String Severity { get; set; } = string.Empty; /// /// Name of the host. /// /// - internal string HostName { get; set; } = ""; + internal string HostName { get; set; } = string.Empty; /// /// Name of the host application. @@ -36,37 +36,37 @@ namespace System.Management.Automation /// Version of the host. /// /// - internal string HostVersion { get; set; } = ""; + internal string HostVersion { get; set; } = string.Empty; /// /// Id of the host that is hosting current monad engine. /// /// - internal string HostId { get; set; } = ""; + internal string HostId { get; set; } = string.Empty; /// /// Version of monad engine. /// /// - internal string EngineVersion { get; set; } = ""; + internal string EngineVersion { get; set; } = string.Empty; /// /// Id for currently running runspace /// /// - internal string RunspaceId { get; set; } = ""; + internal string RunspaceId { get; set; } = string.Empty; /// /// PipelineId of current running pipeline /// /// - internal string PipelineId { get; set; } = ""; + internal string PipelineId { get; set; } = string.Empty; /// /// Command text that is typed in from commandline /// /// - internal string CommandName { get; set; } = ""; + internal string CommandName { get; set; } = string.Empty; /// /// Type of the command, which can be Alias, CommandLet, Script, Application, etc. @@ -74,32 +74,32 @@ namespace System.Management.Automation /// The value of this property is a usually conversion of CommandTypes enum into a string. /// /// - internal string CommandType { get; set; } = ""; + internal string CommandType { get; set; } = string.Empty; /// /// Script file name if current command is executed as a result of script run. /// - internal string ScriptName { get; set; } = ""; + internal string ScriptName { get; set; } = string.Empty; /// /// Path to the command executable file. /// - internal string CommandPath { get; set; } = ""; + internal string CommandPath { get; set; } = string.Empty; /// /// Extension for the command executable file. /// - internal string CommandLine { get; set; } = ""; + internal string CommandLine { get; set; } = string.Empty; /// /// Sequence Id for the event to be logged. /// - internal string SequenceNumber { get; set; } = ""; + internal string SequenceNumber { get; set; } = string.Empty; /// /// Current user. /// - internal string User { get; set; } = ""; + internal string User { get; set; } = string.Empty; /// /// The user connected to the machine, if being done with @@ -110,7 +110,7 @@ namespace System.Management.Automation /// /// Event happening time /// - internal string Time { get; set; } = ""; + internal string Time { get; set; } = string.Empty; #endregion diff --git a/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs b/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs index 207930cbd..4c0abde42 100644 --- a/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs +++ b/src/System.Management.Automation/logging/eventlog/EventLogLogProvider.cs @@ -118,8 +118,8 @@ namespace System.Management.Automation else { mapArgs["ExceptionClass"] = exception.GetType().Name; - mapArgs["ErrorCategory"] = ""; - mapArgs["ErrorId"] = ""; + mapArgs["ErrorCategory"] = string.Empty; + mapArgs["ErrorId"] = string.Empty; mapArgs["ErrorMessage"] = exception.Message; } @@ -239,8 +239,8 @@ namespace System.Management.Automation else { mapArgs["ExceptionClass"] = exception.GetType().Name; - mapArgs["ErrorCategory"] = ""; - mapArgs["ErrorId"] = ""; + mapArgs["ErrorCategory"] = string.Empty; + mapArgs["ErrorId"] = string.Empty; mapArgs["ErrorMessage"] = exception.Message; } @@ -418,8 +418,8 @@ namespace System.Management.Automation else { mapArgs["ExceptionClass"] = exception.GetType().Name; - mapArgs["ErrorCategory"] = ""; - mapArgs["ErrorId"] = ""; + mapArgs["ErrorCategory"] = string.Empty; + mapArgs["ErrorId"] = string.Empty; mapArgs["ErrorMessage"] = exception.Message; } @@ -587,8 +587,8 @@ namespace System.Management.Automation { string id = ((int)(i + 1)).ToString("d1", CultureInfo.CurrentCulture); - mapArgs["AdditionalInfo_Name" + id] = ""; - mapArgs["AdditionalInfo_Value" + id] = ""; + mapArgs["AdditionalInfo_Name" + id] = string.Empty; + mapArgs["AdditionalInfo_Value" + id] = string.Empty; } return; @@ -610,8 +610,8 @@ namespace System.Management.Automation } else { - mapArgs["AdditionalInfo_Name" + id] = ""; - mapArgs["AdditionalInfo_Value" + id] = ""; + mapArgs["AdditionalInfo_Name" + id] = string.Empty; + mapArgs["AdditionalInfo_Value" + id] = string.Empty; } } @@ -630,12 +630,12 @@ namespace System.Management.Automation private string GetMessage(string messageId, Hashtable mapArgs) { if (_resourceManager == null) - return ""; + return string.Empty; string messageTemplate = _resourceManager.GetString(messageId); if (String.IsNullOrEmpty(messageTemplate)) - return ""; + return string.Empty; return FillMessageTemplate(messageTemplate, mapArgs); } diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 65a06e2d2..42636ff11 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -257,9 +257,9 @@ namespace Microsoft.PowerShell.Commands XmlDocument document = new XmlDocument(); CultureInfo currentUICulture = CultureInfo.CurrentUICulture; string fullHelpPath = Path.Combine( - string.IsNullOrEmpty(this.ProviderInfo.ApplicationBase) ? "" : this.ProviderInfo.ApplicationBase, + string.IsNullOrEmpty(this.ProviderInfo.ApplicationBase) ? string.Empty : this.ProviderInfo.ApplicationBase, currentUICulture.ToString(), - string.IsNullOrEmpty(this.ProviderInfo.HelpFile) ? "" : this.ProviderInfo.HelpFile); + string.IsNullOrEmpty(this.ProviderInfo.HelpFile) ? string.Empty : this.ProviderInfo.HelpFile); XmlReaderSettings settings = new XmlReaderSettings(); settings.XmlResolver = null; @@ -4279,7 +4279,7 @@ namespace Microsoft.PowerShell.Commands } // To accomodate empty files - String content = ""; + String content = string.Empty; if (op["b64Fragment"] != null) { content = (String)op["b64Fragment"]; @@ -5153,7 +5153,7 @@ namespace Microsoft.PowerShell.Commands if (secondColon > 0) { string newPath = path.Substring(0, secondColon); - alternateDataStream = path.Replace(newPath, ""); + alternateDataStream = path.Replace(newPath, string.Empty); path = newPath; } #endif @@ -5304,8 +5304,8 @@ namespace Microsoft.PowerShell.Commands { try { - Stack tokenizedPathStack = TokenizePathToStack(path, ""); - Stack normalizedPath = NormalizeThePath("", tokenizedPathStack); + Stack tokenizedPathStack = TokenizePathToStack(path, string.Empty); + Stack normalizedPath = NormalizeThePath(string.Empty, tokenizedPathStack); return CreateNormalizedRelativePathFromStack(normalizedPath); } catch (UnauthorizedAccessException) @@ -5458,7 +5458,7 @@ namespace Microsoft.PowerShell.Commands } else { - currentPath = ""; + currentPath = string.Empty; } s_tracer.WriteLine("normalizedPathStack.Pop() : {0}", poppedName); @@ -6933,7 +6933,7 @@ namespace Microsoft.PowerShell.Commands } // For filesystem once content is cleared - WriteItemObject("", path, false); + WriteItemObject(string.Empty, path, false); } catch (ArgumentException argException) { @@ -6960,7 +6960,7 @@ namespace Microsoft.PowerShell.Commands fileStream.Dispose(); //For filesystem once content is cleared - WriteItemObject("", path, false); + WriteItemObject(string.Empty, path, false); } catch (UnauthorizedAccessException failure) { @@ -8576,13 +8576,13 @@ namespace System.Management.Automation.Internal string dataStream = ":$DATA"; if (!String.Equals(findStreamData.Name, dataStream, StringComparison.OrdinalIgnoreCase)) { - findStreamData.Name = findStreamData.Name.Replace(dataStream, ""); + findStreamData.Name = findStreamData.Name.Replace(dataStream, string.Empty); } AlternateStreamData data = new AlternateStreamData(); data.Stream = findStreamData.Name; data.Length = findStreamData.Length; - data.FileName = path.Replace(data.Stream, ""); + data.FileName = path.Replace(data.Stream, string.Empty); data.FileName = data.FileName.Trim(Utils.Separators.Colon); alternateStreams.Add(data); diff --git a/src/System.Management.Automation/namespaces/LocationGlobber.cs b/src/System.Management.Automation/namespaces/LocationGlobber.cs index daff55a46..a5b378a6e 100644 --- a/src/System.Management.Automation/namespaces/LocationGlobber.cs +++ b/src/System.Management.Automation/namespaces/LocationGlobber.cs @@ -2136,7 +2136,7 @@ namespace System.Management.Automation providerInstance, context); } - + return relativePath; } catch (PSNotSupportedException) @@ -2145,7 +2145,7 @@ namespace System.Management.Automation // always be empty providerInstance = null; - return ""; + return string.Empty; } } // GetDriveRootRelativePathFromPSPath @@ -2155,7 +2155,7 @@ namespace System.Management.Automation CmdletProviderContext context ) { - string childPath = ""; + string childPath = string.Empty; CmdletProvider providerInstance = _sessionState.Internal.GetContainerProviderInstance(drive.Provider); @@ -2473,7 +2473,7 @@ namespace System.Management.Automation driveRootRelativeWorkingPath = normalizedRelativePath; } else - driveRootRelativeWorkingPath = ""; + driveRootRelativeWorkingPath = string.Empty; } s_tracer.WriteLine( diff --git a/src/System.Management.Automation/namespaces/RegistryProvider.cs b/src/System.Management.Automation/namespaces/RegistryProvider.cs index c614c153b..6fc3cf2f0 100644 --- a/src/System.Management.Automation/namespaces/RegistryProvider.cs +++ b/src/System.Management.Automation/namespaces/RegistryProvider.cs @@ -3218,7 +3218,7 @@ namespace Microsoft.PowerShell.Commands case RegistryValueKind.ExpandString: case RegistryValueKind.String: { - defaultValue = ""; + defaultValue = string.Empty; } break; case RegistryValueKind.MultiString: @@ -3678,7 +3678,7 @@ namespace Microsoft.PowerShell.Commands foundSubkey = true; remainingPath = remainingPath.Equals(normalizedSubkey, StringComparison.OrdinalIgnoreCase) - ? "" + ? string.Empty : remainingPath.Substring((normalizedSubkey + StringLiterals.DefaultPathSeparator).Length); break; @@ -3941,7 +3941,7 @@ namespace Microsoft.PowerShell.Commands value, typeof(string), CultureInfo.CurrentCulture) - : ""; + : string.Empty; break; case RegistryValueKind.MultiString: @@ -3978,7 +3978,7 @@ namespace Microsoft.PowerShell.Commands value, typeof(string), CultureInfo.CurrentCulture) - : ""; + : string.Empty; break; // If kind is Unknown then just leave the value as-is. diff --git a/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs b/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs index 9ece1e4e2..c9b75a870 100644 --- a/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs +++ b/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs @@ -210,7 +210,7 @@ namespace Microsoft.PowerShell.Commands.Internal System.Transactions.Transaction transaction, SafeTransactionHandle txHandle) { _hkey = hkey; - _keyName = ""; + _keyName = string.Empty; if (systemkey) { _state |= STATE_SYSTEMKEY; diff --git a/src/System.Management.Automation/security/CatalogHelper.cs b/src/System.Management.Automation/security/CatalogHelper.cs index 656811612..8f26010df 100644 --- a/src/System.Management.Automation/security/CatalogHelper.cs +++ b/src/System.Management.Automation/security/CatalogHelper.cs @@ -451,7 +451,7 @@ namespace System.Management.Automation byte[] hashBytes = new byte[size]; Marshal.Copy(hashBuffer, hashBytes, 0, size); - hashValue = BitConverter.ToString(hashBytes).Replace("-", ""); + hashValue = BitConverter.ToString(hashBytes).Replace("-", string.Empty); } finally { diff --git a/src/System.Management.Automation/security/CredentialParameter.cs b/src/System.Management.Automation/security/CredentialParameter.cs index 118bd8d9a..066898df7 100644 --- a/src/System.Management.Automation/security/CredentialParameter.cs +++ b/src/System.Management.Automation/security/CredentialParameter.cs @@ -79,7 +79,7 @@ namespace System.Management.Automation caption, prompt, userName, - ""); + string.Empty); } return cred; diff --git a/src/System.Management.Automation/security/SecureStringHelper.cs b/src/System.Management.Automation/security/SecureStringHelper.cs index 7489e8b24..2e83607e4 100644 --- a/src/System.Management.Automation/security/SecureStringHelper.cs +++ b/src/System.Management.Automation/security/SecureStringHelper.cs @@ -166,7 +166,7 @@ namespace Microsoft.PowerShell { Utils.CheckSecureStringArg(input, "input"); - string output = ""; + string output = string.Empty; byte[] data = null; byte[] protectedData = null; diff --git a/src/System.Management.Automation/security/SecuritySupport.cs b/src/System.Management.Automation/security/SecuritySupport.cs index 01f7cf23c..dbd84efe1 100644 --- a/src/System.Management.Automation/security/SecuritySupport.cs +++ b/src/System.Management.Automation/security/SecuritySupport.cs @@ -822,14 +822,14 @@ namespace System.Management.Automation.Internal { get { - string filterString = ""; + string filterString = string.Empty; if (_dnsName != null) { filterString = AppendFilter(filterString, "dns", _dnsName); } - string ekuT = ""; + string ekuT = string.Empty; if (_eku != null) { for (int i = 0; i < _eku.Length; i++) @@ -1076,7 +1076,7 @@ namespace System.Management.Automation int startContent = startIndex + beginMarker.Length; int endContent = endIndex - endMarker.Length; string encodedContent = actualContent.Substring(startContent, endContent - startContent); - encodedContent = System.Text.RegularExpressions.Regex.Replace(encodedContent, "\\s", ""); + encodedContent = System.Text.RegularExpressions.Regex.Replace(encodedContent, "\\s", string.Empty); messageBytes = Convert.FromBase64String(encodedContent); return messageBytes; diff --git a/src/System.Management.Automation/security/nativeMethods.cs b/src/System.Management.Automation/security/nativeMethods.cs index 2200eb450..fcad158b3 100644 --- a/src/System.Management.Automation/security/nativeMethods.cs +++ b/src/System.Management.Automation/security/nativeMethods.cs @@ -719,7 +719,7 @@ namespace System.Management.Automation.Security si.dwAdditionalCertChoice = GetCertChoiceFromSigningOption(option); CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO siex = - InitSignInfoExtendedStruct("", "", hashAlgorithm); + InitSignInfoExtendedStruct(string.Empty, string.Empty, hashAlgorithm); IntPtr pSiexBuffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(siex)); Marshal.StructureToPtr(siex, pSiexBuffer, false); si.pSignExtInfo = pSiexBuffer; diff --git a/src/System.Management.Automation/security/wldpNativeMethods.cs b/src/System.Management.Automation/security/wldpNativeMethods.cs index 112cbd6d2..4e96fdfb2 100644 --- a/src/System.Management.Automation/security/wldpNativeMethods.cs +++ b/src/System.Management.Automation/security/wldpNativeMethods.cs @@ -470,7 +470,7 @@ namespace System.Management.Automation.Security internal static string DumpLockdownState(uint pdwLockdownState) { - string returnValue = ""; + string returnValue = string.Empty; if ((pdwLockdownState & WldpNativeConstants.WLDP_LOCKDOWN_DEFINED_FLAG) == WldpNativeConstants.WLDP_LOCKDOWN_DEFINED_FLAG) { diff --git a/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs b/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs index e3eacff36..d68f7f154 100644 --- a/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs +++ b/src/System.Management.Automation/singleshell/config/MshSnapinLoadException.cs @@ -145,8 +145,8 @@ namespace System.Management.Automation.Runspaces } } - private string _PSSnapin = ""; - private string _reason = ""; + private string _PSSnapin = string.Empty; + private string _reason = string.Empty; /// /// Gets message for this exception. diff --git a/src/System.Management.Automation/utils/FormatAndTypeDataHelper.cs b/src/System.Management.Automation/utils/FormatAndTypeDataHelper.cs index efdf60c06..3b5c3e31c 100644 --- a/src/System.Management.Automation/utils/FormatAndTypeDataHelper.cs +++ b/src/System.Management.Automation/utils/FormatAndTypeDataHelper.cs @@ -147,7 +147,7 @@ namespace System.Management.Automation.Runspaces allErrors.Append('\n'); } - string message = ""; + string message = string.Empty; if (category == RunspaceConfigurationCategory.Types) { message = @@ -181,7 +181,7 @@ namespace System.Management.Automation.Runspaces allErrors.Append('\n'); } - string message = ""; + string message = string.Empty; if (category == RunspaceConfigurationCategory.Types) { message = diff --git a/src/System.Management.Automation/utils/PowerShellETWTracer.cs b/src/System.Management.Automation/utils/PowerShellETWTracer.cs index 487cef5e3..7975ec44d 100644 --- a/src/System.Management.Automation/utils/PowerShellETWTracer.cs +++ b/src/System.Management.Automation/utils/PowerShellETWTracer.cs @@ -1085,7 +1085,7 @@ namespace System.Management.Automation.Tracing { return DebugChannel.TraceDebug(PowerShellTraceEvent.Job, PowerShellTraceOperationCode.Method, PowerShellTraceTask.None, - "", "", "NULL job"); + string.Empty, string.Empty, "NULL job"); } } diff --git a/src/System.Management.Automation/utils/RuntimeException.cs b/src/System.Management.Automation/utils/RuntimeException.cs index 9a0e04dec..d496da9de 100644 --- a/src/System.Management.Automation/utils/RuntimeException.cs +++ b/src/System.Management.Automation/utils/RuntimeException.cs @@ -223,21 +223,21 @@ namespace System.Management.Automation internal static string RetrieveMessage(ErrorRecord errorRecord) { if (null == errorRecord) - return ""; + return string.Empty; if (null != errorRecord.ErrorDetails && !String.IsNullOrEmpty(errorRecord.ErrorDetails.Message)) { return errorRecord.ErrorDetails.Message; } if (null == errorRecord.Exception) - return ""; + return string.Empty; return errorRecord.Exception.Message; } internal static string RetrieveMessage(Exception e) { if (null == e) - return ""; + return string.Empty; IContainsErrorRecord icer = e as IContainsErrorRecord; if (null == icer) diff --git a/src/System.Management.Automation/utils/SessionStateExceptions.cs b/src/System.Management.Automation/utils/SessionStateExceptions.cs index a6082744e..6ada370b2 100644 --- a/src/System.Management.Automation/utils/SessionStateExceptions.cs +++ b/src/System.Management.Automation/utils/SessionStateExceptions.cs @@ -283,7 +283,7 @@ namespace System.Management.Automation { Diagnostics.Assert(false, "ProviderInvocationException.RetrieveMessage needs innerException"); - return ""; + return string.Empty; } if (String.IsNullOrEmpty(errorId)) { diff --git a/src/System.Management.Automation/utils/StructuredTraceSource.cs b/src/System.Management.Automation/utils/StructuredTraceSource.cs index cca0627e9..ed28a8820 100644 --- a/src/System.Management.Automation/utils/StructuredTraceSource.cs +++ b/src/System.Management.Automation/utils/StructuredTraceSource.cs @@ -605,7 +605,7 @@ namespace System.Management.Automation eventHandlerOutputFormatter, eventHandlerLeavingFormatter, methodName, - ""); + string.Empty); } catch { @@ -1613,7 +1613,7 @@ namespace System.Management.Automation scopeOutputFormatter, leavingScopeFormatter, scopeName, - ""); + string.Empty); } /// @@ -1687,7 +1687,7 @@ namespace System.Management.Automation scopeOutputFormatter, leavingScopeFormatter, scopeName, - ""); + string.Empty); } } diff --git a/src/System.Management.Automation/utils/tracing/PSEtwLog.cs b/src/System.Management.Automation/utils/tracing/PSEtwLog.cs index 64893f58e..80feafcc0 100644 --- a/src/System.Management.Automation/utils/tracing/PSEtwLog.cs +++ b/src/System.Management.Automation/utils/tracing/PSEtwLog.cs @@ -225,7 +225,7 @@ namespace System.Management.Automation.Tracing if (provider.IsEnabled(PSLevel.Verbose, keyword)) { string payLoadData = BitConverter.ToString(fragmentData.blob, fragmentData.offset, fragmentData.length); - payLoadData = string.Format(CultureInfo.InvariantCulture, "0x{0}", payLoadData.Replace("-", "")); + payLoadData = string.Format(CultureInfo.InvariantCulture, "0x{0}", payLoadData.Replace("-", string.Empty)); provider.WriteEvent(id, PSChannel.Analytic, opcode, PSLevel.Verbose, task, keyword, objectId, fragmentId, isStartFragment, isEndFragment, fragmentLength, diff --git a/test/csharp/test_FileSystemProvider.cs b/test/csharp/test_FileSystemProvider.cs index 48528e2b6..6dfe9bf72 100644 --- a/test/csharp/test_FileSystemProvider.cs +++ b/test/csharp/test_FileSystemProvider.cs @@ -61,11 +61,11 @@ namespace PSTests.Parallel { if(!Platform.IsWindows) { - Assert.False(InternalSymbolicLinkLinkCodeMethods.CreateJunction("","")); + Assert.False(InternalSymbolicLinkLinkCodeMethods.CreateJunction(string.Empty, string.Empty)); } else { - Assert.Throws(delegate { InternalSymbolicLinkLinkCodeMethods.CreateJunction("",""); }); + Assert.Throws(delegate { InternalSymbolicLinkLinkCodeMethods.CreateJunction(string.Empty, string.Empty); }); } } diff --git a/test/csharp/test_SecuritySupport.cs b/test/csharp/test_SecuritySupport.cs index 8d82799dd..efad910cd 100644 --- a/test/csharp/test_SecuritySupport.cs +++ b/test/csharp/test_SecuritySupport.cs @@ -11,7 +11,7 @@ namespace PSTests.Parallel [Fact] public static void TestScanContent() { - Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent("", "")); + Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty)); } [Fact] diff --git a/test/tools/WebListener/Controllers/RedirectController.cs b/test/tools/WebListener/Controllers/RedirectController.cs index 8a65c5626..b32722b38 100644 --- a/test/tools/WebListener/Controllers/RedirectController.cs +++ b/test/tools/WebListener/Controllers/RedirectController.cs @@ -19,7 +19,7 @@ namespace mvc.Controllers { public IActionResult Index(int count) { - string url = Regex.Replace(input: Request.GetDisplayUrl(), pattern: "\\/Redirect.*", replacement: "", options: RegexOptions.IgnoreCase); + string url = Regex.Replace(input: Request.GetDisplayUrl(), pattern: "\\/Redirect.*", replacement: string.Empty, options: RegexOptions.IgnoreCase); if (count <= 1) { url = $"{url}/Get/";