CodeFactor code style cleanup: replace literal empty strings with 'string.Empty' (#6950)

This commit is contained in:
Ilya 2018-06-13 00:30:10 +05:00 committed by Dongbo Wang
parent 11a98c47fb
commit e177fcaef6
160 changed files with 765 additions and 777 deletions

View file

@ -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 + ", ";

View file

@ -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
{

View file

@ -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<string, string[]> CounterInstanceMapping
{

View file

@ -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[");

View file

@ -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;
}

View file

@ -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
{

View file

@ -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

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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))

View file

@ -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;
}
/// <summary>

View file

@ -32,7 +32,7 @@ namespace Microsoft.PowerShell.Commands
internal Collection<string> ParseCsv(string csv)
{
Collection<string> result = new Collection<string>();
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++;
}

View file

@ -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);
}
}

View file

@ -173,7 +173,7 @@ namespace Microsoft.PowerShell.Commands
}
else
{
_typesAlreadyDisplayed.Add(typeName, "");
_typesAlreadyDisplayed.Add(typeName, string.Empty);
}
PSMemberTypes memberTypeToSearch = MemberType;

View file

@ -94,7 +94,7 @@ namespace Microsoft.PowerShell.Commands
/// Returns the text of the matching line.
/// </summary>
/// <value>The text of the matching line.</value>
public string Line { get; set; } = "";
public string Line { get; set; } = string.Empty;
/// <summary>
/// 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;

View file

@ -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);
}

View file

@ -141,7 +141,7 @@ namespace Microsoft.PowerShell.Commands
Collection<FieldDescription> fdc = new Collection<FieldDescription>();
fdc.Add(fd);
Dictionary<string, PSObject> result = Host.UI.Prompt("", "", fdc);
Dictionary<string, PSObject> 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)

View file

@ -306,7 +306,7 @@ namespace Microsoft.PowerShell.Commands
public virtual object Body { get; set; }
/// <summary>
/// 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.
/// </summary>
@ -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))

View file

@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
protected override void ProcessRecord()
{
string result = ProcessObject(Object) ?? "";
string result = ProcessObject(Object) ?? string.Empty;
HostInformationMessage informationMessage = new HostInformationMessage();
informationMessage.Message = result;

View file

@ -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;
}
/// <summary>

View file

@ -29,7 +29,7 @@ namespace Microsoft.PowerShell.Commands
/// Default constructor used if no.
/// </summary>
internal PSHostTraceListener(PSCmdlet cmdlet)
: base("")
: base(string.Empty)
{
if (cmdlet == null)
{

View file

@ -256,7 +256,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Parameter(ParameterSetName = "NoException")]
[Parameter(ParameterSetName = "WithException")]
public string ErrorId { get; set; } = "";
public string ErrorId { get; set; } = string.Empty;
/// <summary>
/// ErrorRecord.TargetObject
@ -269,7 +269,7 @@ namespace Microsoft.PowerShell.Commands
/// ErrorRecord.ErrorDetails.RecommendedAction
/// </summary>
[Parameter]
public string RecommendedAction { get; set; } = "";
public string RecommendedAction { get; set; } = string.Empty;
/* 2005/01/25 removing throw-error
/// <summary>
@ -283,28 +283,28 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Parameter]
[Alias("Activity")]
public string CategoryActivity { get; set; } = "";
public string CategoryActivity { get; set; } = string.Empty;
/// <summary>
/// ErrorRecord.CategoryInfo.Reason
/// </summary>
[Parameter]
[Alias("Reason")]
public string CategoryReason { get; set; } = "";
public string CategoryReason { get; set; } = string.Empty;
/// <summary>
/// ErrorRecord.CategoryInfo.TargetName
/// </summary>
[Parameter]
[Alias("TargetName")]
public string CategoryTargetName { get; set; } = "";
public string CategoryTargetName { get; set; } = string.Empty;
/// <summary>
/// ErrorRecord.CategoryInfo.TargetType
/// </summary>
[Parameter]
[Alias("TargetType")]
public string CategoryTargetType { get; set; } = "";
public string CategoryTargetType { get; set; } = string.Empty;
/// <summary>
/// Write an error to the output pipe, or throw a terminating error.

View file

@ -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()

View file

@ -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<TextReader> ConsoleIn { get; } = new Lazy<TextReader>(() => Console.In);
private string _savedWindowTitle = "";
private string _savedWindowTitle = string.Empty;
private Version _ver = PSVersionInfo.PSVersion;
private int _exitCodeFromRunspace;
private bool _noExit = true;

View file

@ -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);
}
/// <summary>
@ -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

View file

@ -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)
{

View file

@ -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);

View file

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Import Project="..\..\PowerShell.Common.props" />
<PropertyGroup>
<Description>PowerShell Core's Microsoft.PowerShell.PSReadLine project</Description>
<AssemblyName>Microsoft.PowerShell.PSReadLine</AssemblyName>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
</ItemGroup>
</Project>

View file

@ -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);
}

View file

@ -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);
//

View file

@ -377,7 +377,7 @@ namespace Microsoft.PowerShell.Commands
_timestampServer = value;
}
}
private string _timestampServer = "";
private string _timestampServer = string.Empty;
/// <summary>
/// Gets or sets the hash algorithm used for signing.

View file

@ -53,7 +53,7 @@ namespace Microsoft.PowerShell
hostUI.Write(prompt);
ss = hostUI.ReadLineAsSecureString();
hostUI.WriteLine("");
hostUI.WriteLine(string.Empty);
return ss;
}

View file

@ -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 = "<WsManResults>" + valuexml + "</WsManResults>";
}
@ -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)
{
//<Security Uri="" ExactMatch="false" Sddl="O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;ER)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)"/>
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
// <InitializationParameters>
//<Param Name="Param1" Value="Value1" />
//</InitializationParameters>
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("<Capability");

View file

@ -199,8 +199,8 @@ namespace Microsoft.WSMan.Management
#endif
/// <summary><para><c>CreateSession</c> method of <c>IWSMan</c> interface.</para></summary>
/// <remarks><para>An original IDL definition of <c>CreateSession</c> method was the following: <c>HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// IDL: HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue);
/// <remarks><para>An original IDL definition of <c>CreateSession</c> method was the following: <c>HRESULT CreateSession ([optional, defaultvalue(string.Empty)] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// 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
/// <summary><para><c>CreateSession</c> method of <c>IWSManEx</c> interface.</para></summary>
/// <remarks><para>An original IDL definition of <c>CreateSession</c> method was the following: <c>HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// IDL: HRESULT CreateSession ([optional, defaultvalue("")] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue);
/// <remarks><para>An original IDL definition of <c>CreateSession</c> method was the following: <c>HRESULT CreateSession ([optional, defaultvalue(string.Empty)] BSTR connection, [optional, defaultvalue(0)] long flags, [optional] IDispatch* connectionOptions, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// 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
}
/// <summary><para><c>CreateResourceLocator</c> method of <c>IWSManEx</c> interface.</para></summary>
/// <remarks><para>An original IDL definition of <c>CreateResourceLocator</c> method was the following: <c>HRESULT CreateResourceLocator ([optional, defaultvalue("")] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// IDL: HRESULT CreateResourceLocator ([optional, defaultvalue("")] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue);
/// <remarks><para>An original IDL definition of <c>CreateResourceLocator</c> method was the following: <c>HRESULT CreateResourceLocator ([optional, defaultvalue(string.Empty)] BSTR strResourceLocator, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// 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);
/// <summary><para><c>Enumerate</c> method of <c>IWSManSession</c> interface.</para></summary>
/// <remarks><para>An original IDL definition of <c>Enumerate</c> method was the following: <c>HRESULT Enumerate (VARIANT resourceUri, [optional, defaultvalue("")] BSTR filter, [optional, defaultvalue("")] BSTR dialect, [optional, defaultvalue(0)] long flags, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>
// IDL: HRESULT Enumerate (VARIANT resourceUri, [optional, defaultvalue("")] BSTR filter, [optional, defaultvalue("")] BSTR dialect, [optional, defaultvalue(0)] long flags, [out, retval] IDispatch** ReturnValue);
/// <remarks><para>An original IDL definition of <c>Enumerate</c> method was the following: <c>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)</c>;</para></remarks>
// 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

View file

@ -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);

View file

@ -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);

View file

@ -419,7 +419,7 @@ namespace System.Management.Automation
/// </summary>
/// <returns>
/// 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).
/// </returns>
private static string InternalGetFolderPath(System.Environment.SpecialFolder folder)
{

View file

@ -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();

View file

@ -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);
}
/// <summary>
@ -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);
}
/// <summary>
@ -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);
}
/// <summary>
@ -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
/// </summary>
internal override void GroupStart()
{
this.InnerCommand._lo.WriteLine("");
this.InnerCommand._lo.WriteLine(string.Empty);
}
/// <summary>
@ -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);
}
/// <summary>
@ -1187,7 +1187,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
/// </summary>
internal override void GroupStart()
{
this.InnerCommand._lo.WriteLine("");
this.InnerCommand._lo.WriteLine(string.Empty);
}
/// <summary>
@ -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();

View file

@ -701,7 +701,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
{
if (string.IsNullOrEmpty(s))
{
return "";
return string.Empty;
}
int lineBreak = s.IndexOfAny(s_lineBreakChars);

View file

@ -382,7 +382,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
{
return FormatShape.Complex.ToString();
}
return "";
return string.Empty;
}
/// <summary>

View file

@ -429,7 +429,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
}
else
{
fpf.propertyValue = "";
fpf.propertyValue = string.Empty;
}
return fpf;
}

View file

@ -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

View file

@ -201,7 +201,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
}
else
{
ci.label = "";
ci.label = string.Empty;
}
}

View file

@ -82,7 +82,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
}
}
return "";
return string.Empty;
}
internal void Initialize(TerminatingErrorContext errorContext,

View file

@ -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)

View file

@ -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;

View file

@ -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
{

View file

@ -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);
}

View file

@ -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");

View file

@ -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)

View file

@ -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;
}
/// <summary>

View file

@ -234,7 +234,7 @@ namespace System.Management.Automation
return "object[]";
case VarEnum.VT_EMPTY:
return "";
return string.Empty;
default:
return "Unknown!";

View file

@ -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);
}
}

View file

@ -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;

View file

@ -513,7 +513,7 @@ namespace System.Management.Automation
// Handle operator completion: 55 -<tab> || "string" -<tab> || (Get-Something) -<tab>
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

View file

@ -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)

View file

@ -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);
}

View file

@ -648,7 +648,7 @@ namespace System.Management.Automation
/// <summary>
/// The prefix that was used when importing this command
/// </summary>
internal string Prefix { get; set; } = "";
internal string Prefix { get; set; } = string.Empty;
/// <summary>
/// Create a copy of commandInfo for GetCommandCommand so that we can generate parameter

View file

@ -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)

View file

@ -405,7 +405,7 @@ namespace System.Management.Automation
else
{
user = input;
domain = "";
domain = string.Empty;
}
}
}

View file

@ -29,7 +29,7 @@ namespace System.Management.Automation
/// <summary>
/// Gets the help file path for the provider.
/// </summary>
public string HelpFile { get; } = "";
public string HelpFile { get; } = string.Empty;
/// <summary>
/// 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;

View file

@ -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;
/// <summary>
/// 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;
}

View file

@ -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);

View file

@ -252,7 +252,7 @@ namespace System.Management.Automation
/// <value>The script name or "" if there was no script.</value>
public string ScriptName
{
get { return ScriptPosition.File ?? ""; }
get { return ScriptPosition.File ?? string.Empty; }
}
/// <summary>
@ -315,7 +315,7 @@ namespace System.Management.Automation
/// <value>The name string.</value>
public string InvocationName
{
get { return _invocationName ?? ""; }
get { return _invocationName ?? string.Empty; }
internal set { _invocationName = value; }
}

View file

@ -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)
{

View file

@ -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;
}

View file

@ -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;
}

View file

@ -85,7 +85,7 @@ namespace Microsoft.PowerShell.Commands
get { return _companyName; }
set { _companyName = value; }
}
private string _companyName = "";
private string _companyName = string.Empty;
/// <summary>
/// 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;
/// <summary>
/// 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);
}

View file

@ -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}",

View file

@ -553,4 +553,4 @@ namespace System.Management.Automation
internal string Name { get; set; }
internal List<string> CommandsToPostFilter { get; set; }
}
} // System.Management.Automation
} // System.Management.Automation

View file

@ -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)) ||

View file

@ -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);

View file

@ -2362,7 +2362,7 @@ namespace System.Management.Automation
/// </summary>
public override string ToString()
{
return "";
return string.Empty;
}
}

View file

@ -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);

View file

@ -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;
}
}

View file

@ -44,7 +44,7 @@ namespace System.Management.Automation
throw PSTraceSource.NewArgumentNullException("commandMetaData");
}
return commandMetadata.GetProxyCommand("", true);
return commandMetadata.GetProxyCommand(string.Empty, true);
}
/// <summary>

View file

@ -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);

View file

@ -222,7 +222,7 @@ namespace System.Management.Automation
{
exception =
new SessionStateException(
"",
string.Empty,
SessionStateCategory.Command,
"CommandIsPrivate",
SessionStateStrings.CommandIsPrivate,

View file

@ -19,7 +19,7 @@ namespace Microsoft.PowerShell.Commands.Management
/// <summary>
/// Constructor for the TransactedString class.
/// </summary>
public TransactedString() : this("")
public TransactedString() : this(string.Empty)
{
}

View file

@ -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(

View file

@ -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)
{

View file

@ -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;
}

View file

@ -281,7 +281,7 @@ namespace System.Management.Automation
{
get { return _definition; }
}
private string _definition = "";
private string _definition = string.Empty;
/// <summary>
/// Gets the XAML that represents the definition of the workflow.

View file

@ -119,7 +119,7 @@ namespace System.Management.Automation
{
_parameterSetName = parameterSetName;
}
private string _parameterSetName = "";
private string _parameterSetName = string.Empty;
#region Override Internal

View file

@ -4956,28 +4956,28 @@ namespace System.Management.Automation
/// </summary>
private void DisplayHelp(PSHost host, IList<PSObject> 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);
}
/// <summary>

View file

@ -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

View file

@ -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);
}

View file

@ -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;

View file

@ -186,7 +186,7 @@ namespace System.Management.Automation
basePath = GetAllUsersFolderPath(shellId);
if (string.IsNullOrEmpty(basePath))
{
return "";
return string.Empty;
}
}

View file

@ -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;

View file

@ -121,7 +121,7 @@ namespace System.Management.Automation.Host
/// </summary>
public virtual void WriteLine()
{
WriteLine("");
WriteLine(string.Empty);
}
/// <summary>

View file

@ -361,7 +361,7 @@ namespace Microsoft.PowerShell
{
long numberLangs = 0;
int bufferSize = 0;
string returnval = "";
string returnval = string.Empty;
if (filterOutNonConsoleCultures)
{

View file

@ -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)

View file

@ -53,7 +53,7 @@ namespace System.Management.Automation.Interpreter
public override string ToDebugString(int instructionIndex, object cookie, Func<int, int> labelIndexer, IList<object> 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()

View file

@ -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()

View file

@ -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()

View file

@ -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
/// <returns>The result of the operator</returns>
internal static object UnaryJoinOperator(ExecutionContext context, IScriptExtent errorPosition, object lval)
{
return JoinOperator(context, errorPosition, lval, "");
return JoinOperator(context, errorPosition, lval, string.Empty);
}
/// <summary>
@ -889,8 +889,8 @@ namespace System.Management.Automation
/// <returns>The result of the operator</returns>
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;

View file

@ -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<FunctionContext>[]));
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<Expression>();
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<Expression>
{

Some files were not shown because too many files have changed in this diff Show more