Use Type.EmptyTypes
and Array.Empty<T>()
to replace our custom code of the same functionality (#9042)
This commit is contained in:
parent
43487b4068
commit
759c4abde8
|
@ -171,7 +171,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
set { _computerName = value; }
|
||||
}
|
||||
|
||||
private string[] _computerName = new string[0];
|
||||
private string[] _computerName = Array.Empty<string>();
|
||||
|
||||
private ResourceManager _resourceMgr = null;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
set { _listSet = value; }
|
||||
}
|
||||
|
||||
private string[] _listSet = new string[0];
|
||||
private string[] _listSet = Array.Empty<string>();
|
||||
|
||||
//
|
||||
// StartTime parameter
|
||||
|
@ -138,7 +138,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
set { _counter = value; }
|
||||
}
|
||||
|
||||
private string[] _counter = new string[0];
|
||||
private string[] _counter = Array.Empty<string>();
|
||||
|
||||
//
|
||||
// Summary switch
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[AllowNull]
|
||||
[AllowEmptyString]
|
||||
[AllowEmptyCollection]
|
||||
public string[] AdditionalChildPath { get; set; } = Utils.EmptyArray<string>();
|
||||
public string[] AdditionalChildPath { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the path should be resolved after being joined.
|
||||
|
|
|
@ -268,7 +268,7 @@ $result
|
|||
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
|
||||
{
|
||||
ps.AddScript(TestHeadlessServerScript);
|
||||
Collection<PSObject> psObjectCollection = ps.Invoke(new object[0]);
|
||||
Collection<PSObject> psObjectCollection = ps.Invoke(Array.Empty<object>());
|
||||
Dbg.Assert(psObjectCollection != null && psObjectCollection.Count == 1, "invoke should never return null, there should be only one return item");
|
||||
if (LanguagePrimitives.IsTrue(PSObject.Base(psObjectCollection[0])))
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("Cn")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public string[] ComputerName { get; set; } = new string[0];
|
||||
public string[] ComputerName { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Read only this number of entries.
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = Utils.EmptyArray<string>();
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_property = value;
|
||||
|
@ -111,7 +111,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The property to be created.
|
||||
/// </summary>
|
||||
private string[] _property = new string[0];
|
||||
private string[] _property = Array.Empty<string>();
|
||||
|
||||
#endregion parameter data
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
get;
|
||||
set;
|
||||
} = new string[0];
|
||||
} = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exclude property.
|
||||
|
@ -202,7 +202,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
get;
|
||||
set;
|
||||
} = new string[0];
|
||||
} = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the force property.
|
||||
|
@ -351,7 +351,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] PSProvider
|
||||
{
|
||||
get => _provider;
|
||||
set => _provider = value ?? Utils.EmptyArray<string>();
|
||||
set => _provider = value ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -401,7 +401,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The name of the provider from which to return the current location.
|
||||
/// </summary>
|
||||
private string[] _provider = new string[0];
|
||||
private string[] _provider = Array.Empty<string>();
|
||||
|
||||
#endregion Location parameter set data
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] PSProvider
|
||||
{
|
||||
get => _provider;
|
||||
set => _provider = value ?? Utils.EmptyArray<string>();
|
||||
set => _provider = value ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1563,7 +1563,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The name of the provider(s) for which to remove all drives.
|
||||
/// </summary>
|
||||
private string[] _provider = new string[0];
|
||||
private string[] _provider = Array.Empty<string>();
|
||||
|
||||
#endregion Command data
|
||||
|
||||
|
@ -1717,7 +1717,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] PSProvider
|
||||
{
|
||||
get => _provider;
|
||||
set => _provider = value ?? Utils.EmptyArray<string>();
|
||||
set => _provider = value ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
#endregion Command parameters
|
||||
|
@ -1732,7 +1732,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The provider ID for the drives you want to see.
|
||||
/// </summary>
|
||||
private string[] _provider = new string[0];
|
||||
private string[] _provider = Array.Empty<string>();
|
||||
|
||||
#endregion Command data
|
||||
|
||||
|
@ -4137,7 +4137,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] PSProvider
|
||||
{
|
||||
get => _provider;
|
||||
set => _provider = value ?? Utils.EmptyArray<string>();
|
||||
set => _provider = value ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
#endregion Command parameters
|
||||
|
@ -4146,7 +4146,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The string ID of the provider to remove.
|
||||
/// </summary>
|
||||
private string[] _provider = new string[0];
|
||||
private string[] _provider = Array.Empty<string>();
|
||||
|
||||
#endregion Command data
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Dbg = System.Management.Automation;
|
||||
|
||||
|
@ -70,7 +71,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The path to the item.
|
||||
/// </summary>
|
||||
internal string[] paths = new string[0];
|
||||
internal string[] paths = Array.Empty<string>();
|
||||
|
||||
#endregion parameter data
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Dbg = System.Management.Automation;
|
||||
|
||||
|
@ -62,7 +63,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
get { return _property; }
|
||||
|
||||
set { _property = value ?? Utils.EmptyArray<string>(); }
|
||||
set { _property = value ?? Array.Empty<string>(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -120,7 +121,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The property to be created.
|
||||
/// </summary>
|
||||
private string[] _property = new string[0];
|
||||
private string[] _property = Array.Empty<string>();
|
||||
|
||||
#endregion parameter data
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
var emptyArray = Utils.EmptyArray<object>();
|
||||
var emptyArray = Array.Empty<object>();
|
||||
_transactedScript.InvokeUsingCmdlet(
|
||||
contextCmdlet: this,
|
||||
useLocalScope: false,
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
if (_content == null)
|
||||
{
|
||||
_content = new object[0];
|
||||
_content = Array.Empty<object>();
|
||||
}
|
||||
|
||||
if (_pipingPaths)
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[ValidateNotNull()]
|
||||
[Alias("Using")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public string[] UsingNamespace { get; set; } = Utils.EmptyArray<string>();
|
||||
public string[] UsingNamespace { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The path to the source code or DLL to load.
|
||||
|
@ -310,7 +310,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] referencedAssemblies = Utils.EmptyArray<string>();
|
||||
private string[] referencedAssemblies = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The path to the output assembly.
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
if (_typename == null)
|
||||
{
|
||||
_filter = Utils.EmptyArray<WildcardPattern>();
|
||||
_filter = Array.Empty<WildcardPattern>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -41,10 +41,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
get { return _excludes; }
|
||||
|
||||
set { _excludes = value ?? new string[0]; }
|
||||
set { _excludes = value ?? Array.Empty<string>(); }
|
||||
}
|
||||
|
||||
private string[] _excludes = new string[0];
|
||||
private string[] _excludes = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The scope parameter for the command determines
|
||||
|
|
|
@ -440,7 +440,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = new string[0];
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_PSSnapins = value;
|
||||
|
@ -449,7 +449,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _PSSnapins = new string[0];
|
||||
private string[] _PSSnapins = Array.Empty<string>();
|
||||
internal bool IsModuleSpecified = false;
|
||||
/// <summary>
|
||||
/// Gets or sets the FullyQualifiedModule parameter to the cmdlet.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
|
@ -42,7 +43,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
myScriptBlock.LanguageMode = PSLanguageMode.ConstrainedLanguage;
|
||||
}
|
||||
|
||||
var emptyArray = Utils.EmptyArray<object>();
|
||||
var emptyArray = Array.Empty<object>();
|
||||
myScriptBlock.InvokeUsingCmdlet(
|
||||
contextCmdlet: this,
|
||||
useLocalScope: false,
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
useLocalScope: false,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: InputObject, // $_
|
||||
input: new object[0], // $input
|
||||
input: Array.Empty<object>(), // $input
|
||||
scriptThis: AutomationNull.Value,
|
||||
outputPipe: new Pipe { NullPipe = true },
|
||||
invocationInfo: null);
|
||||
|
|
|
@ -24,14 +24,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
ParameterSetName = FileParameterSet)]
|
||||
[Alias("PSPath", "Path")]
|
||||
[ValidateNotNull]
|
||||
public string[] AppendPath { set; get; } = Utils.EmptyArray<string>();
|
||||
public string[] AppendPath { set; get; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Files to prepend to the existing set.
|
||||
/// </summary>
|
||||
[Parameter(ParameterSetName = FileParameterSet)]
|
||||
[ValidateNotNull]
|
||||
public string[] PrependPath { set; get; } = Utils.EmptyArray<string>();
|
||||
public string[] PrependPath { set; get; } = Array.Empty<string>();
|
||||
|
||||
private static void ReportWrongExtension(string file, string errorId, PSCmdlet cmdlet)
|
||||
{
|
||||
|
|
|
@ -42,14 +42,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = new string[0];
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_include = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _include = new string[0];
|
||||
private string[] _include = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The Exclude parameter for all the variable commands.
|
||||
|
@ -65,14 +65,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = new string[0];
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_exclude = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _exclude = new string[0];
|
||||
private string[] _exclude = Array.Empty<string>();
|
||||
|
||||
#region helpers
|
||||
|
||||
|
|
|
@ -775,7 +775,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
object value;
|
||||
try
|
||||
{
|
||||
value = getMethod.Invoke(o, new object[0]);
|
||||
value = getMethod.Invoke(o, Array.Empty<object>());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
if (ArgumentList == null || ArgumentList.Length == 0)
|
||||
{
|
||||
ConstructorInfo ci = type.GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
ConstructorInfo ci = type.GetConstructor(Type.EmptyTypes);
|
||||
if (ci != null && ci.IsPublic)
|
||||
{
|
||||
_newObject = CallConstructor(type, new ConstructorInfo[] { ci }, new object[] { });
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private PSObject[] _eventArguments = new PSObject[0];
|
||||
private PSObject[] _eventArguments = Array.Empty<PSObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Data relating to this event.
|
||||
|
|
|
@ -262,7 +262,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
dollarUnder: InputObject,
|
||||
input: new object[] { InputObject },
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
}
|
||||
|
||||
private object StepCommand()
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// The TraceSource parameter determines which TraceSource categories the
|
||||
/// operation will take place on.
|
||||
/// </summary>
|
||||
internal string[] NameInternal { get; set; } = new string[0];
|
||||
internal string[] NameInternal { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The flags to be set on the TraceSource.
|
||||
|
|
|
@ -311,7 +311,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
if (values == null) return this.FormatDescription();
|
||||
|
||||
// copy the value IEnumerable to an array.
|
||||
string[] theValues = new string[0];
|
||||
string[] theValues = Array.Empty<string>();
|
||||
int i = 0;
|
||||
foreach (object o in values)
|
||||
{
|
||||
|
|
|
@ -1227,32 +1227,32 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
else return false;
|
||||
case (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeBinary:
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeByte):
|
||||
if (val.Reference == IntPtr.Zero) return new byte[0];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<byte>();
|
||||
byte[] arByte = new byte[val.Count];
|
||||
Marshal.Copy(val.Reference, arByte, 0, (int)val.Count);
|
||||
return arByte;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt16):
|
||||
if (val.Reference == IntPtr.Zero) return new Int16[0];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Int16>();
|
||||
Int16[] arInt16 = new Int16[val.Count];
|
||||
Marshal.Copy(val.Reference, arInt16, 0, (int)val.Count);
|
||||
return arInt16;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt32):
|
||||
if (val.Reference == IntPtr.Zero) return new Int32[0];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Int32>();
|
||||
Int32[] arInt32 = new Int32[val.Count];
|
||||
Marshal.Copy(val.Reference, arInt32, 0, (int)val.Count);
|
||||
return arInt32;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt64):
|
||||
if (val.Reference == IntPtr.Zero) return new Int64[0];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Int64>();
|
||||
Int64[] arInt64 = new Int64[val.Count];
|
||||
Marshal.Copy(val.Reference, arInt64, 0, (int)val.Count);
|
||||
return arInt64;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSingle):
|
||||
if (val.Reference == IntPtr.Zero) return new Single[0];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Single>();
|
||||
Single[] arSingle = new Single[val.Count];
|
||||
Marshal.Copy(val.Reference, arSingle, 0, (int)val.Count);
|
||||
return arSingle;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeDouble):
|
||||
if (val.Reference == IntPtr.Zero) return new Double[0];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Double>();
|
||||
Double[] arDouble = new Double[val.Count];
|
||||
Marshal.Copy(val.Reference, arDouble, 0, (int)val.Count);
|
||||
return arDouble;
|
||||
|
@ -1351,7 +1351,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
IntPtr ptr = val.Reference;
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
return new bool[0];
|
||||
return Array.Empty<bool>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1373,7 +1373,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
IntPtr ptr = val.Reference;
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
return new DateTime[0];
|
||||
return Array.Empty<DateTime>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1394,7 +1394,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
IntPtr ptr = val.Reference;
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
return new DateTime[0];
|
||||
return Array.Empty<DateTime>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1415,7 +1415,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
{
|
||||
if (val.Reference == IntPtr.Zero)
|
||||
{
|
||||
return new string[0];
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -608,12 +608,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// The glob string used to determine which items are included.
|
||||
/// </summary>
|
||||
private string[] _include = new string[0];
|
||||
private string[] _include = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The glob string used to determine which items are excluded.
|
||||
/// </summary>
|
||||
private string[] _exclude = new string[0];
|
||||
private string[] _exclude = Array.Empty<string>();
|
||||
}
|
||||
|
||||
#if !UNIX
|
||||
|
|
|
@ -2797,7 +2797,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal
|
|||
else if (!type.IsAbstract)
|
||||
{
|
||||
// Must have default constructor, at least 1 public property/field, and no base classes
|
||||
if (type.GetConstructor(PSTypeExtensions.EmptyTypes) == null)
|
||||
if (type.GetConstructor(Type.EmptyTypes) == null)
|
||||
{
|
||||
missingDefaultConstructor = true;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
{
|
||||
// if Process() never got called, no sub pipeline
|
||||
// ever got created, hence we just return an empty array
|
||||
return new object[0];
|
||||
return Array.Empty<object>();
|
||||
}
|
||||
|
||||
PipelineProcessor ppTemp = _pp;
|
||||
|
|
|
@ -236,7 +236,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
}
|
||||
else
|
||||
{
|
||||
MethodInfo toStringMethod = x.GetType().GetMethod("ToString", PSTypeExtensions.EmptyTypes);
|
||||
MethodInfo toStringMethod = x.GetType().GetMethod("ToString", Type.EmptyTypes);
|
||||
// TODO:CORECLR double check with CORE CLR that x.GetType() == toStringMethod.ReflectedType
|
||||
// Check if the given object "x" implements "toString" method. Do that by comparing "DeclaringType" which 'Gets the class that declares this member' and the object type
|
||||
if (toStringMethod.DeclaringType == x.GetType())
|
||||
|
|
|
@ -313,7 +313,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
dollarUnder: target,
|
||||
input: AutomationNull.Value,
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
|
||||
if (enumMetadata.BitwiseFlagsSpecified && enumMetadata.BitwiseFlags)
|
||||
{
|
||||
var cab = new CustomAttributeBuilder(typeof(FlagsAttribute).GetConstructor(PSTypeExtensions.EmptyTypes), new object[0]);
|
||||
var cab = new CustomAttributeBuilder(typeof(FlagsAttribute).GetConstructor(Type.EmptyTypes), Array.Empty<object>());
|
||||
eb.SetCustomAttribute(cab);
|
||||
}
|
||||
|
||||
|
|
|
@ -2791,7 +2791,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml
|
|||
if (isNull) return null;
|
||||
global::System.Object o;
|
||||
o = new global::System.Object();
|
||||
bool[] paramsRead = new bool[0];
|
||||
bool[] paramsRead = Array.Empty<bool>();
|
||||
while (Reader.MoveToNextAttribute())
|
||||
{
|
||||
if (!IsXmlnsAttribute(Reader.Name))
|
||||
|
|
|
@ -5143,7 +5143,7 @@ namespace Microsoft.PowerShell.Cmdletization.Xml
|
|||
if (isNull) return null;
|
||||
global::System.Object o;
|
||||
o = new global::System.Object();
|
||||
bool[] paramsRead = new bool[0];
|
||||
bool[] paramsRead = Array.Empty<bool>();
|
||||
while (Reader.MoveToNextAttribute())
|
||||
{
|
||||
if (!IsXmlnsAttribute(Reader.Name))
|
||||
|
|
|
@ -506,7 +506,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
else
|
||||
{
|
||||
Type = Utils.EmptyArray<PSTypeName>();
|
||||
Type = Array.Empty<PSTypeName>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
else
|
||||
{
|
||||
Type = Utils.EmptyArray<PSTypeName>();
|
||||
Type = Array.Empty<PSTypeName>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1427,7 +1427,7 @@ namespace System.Management.Automation
|
|||
dollarUnder: LanguagePrimitives.AsPSObjectOrNull(element),
|
||||
input: AutomationNull.Value,
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
|
||||
if (!LanguagePrimitives.IsTrue(result))
|
||||
{
|
||||
|
|
|
@ -423,7 +423,7 @@ namespace System.Management.Automation
|
|||
// The COM object is a collection and also a IDispatch interface, so we try to get a
|
||||
// IEnumVARIANT interface out of it by invoking its '_NewEnum (DispId: -4)' function.
|
||||
var result = ComInvoker.Invoke(target, ComTypeInfo.DISPID_NEWENUM,
|
||||
args: Utils.EmptyArray<object>(), byRef: null,
|
||||
args: Array.Empty<object>(), byRef: null,
|
||||
invokeKind: comTypeInfo.NewEnumInvokeKind.Value);
|
||||
enumVariant = result as COM.IEnumVARIANT;
|
||||
if (enumVariant != null)
|
||||
|
|
|
@ -3792,7 +3792,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
try
|
||||
{
|
||||
output = script.DoInvoke(inputToOperateOn, inputToOperateOn, Utils.EmptyArray<object>());
|
||||
output = script.DoInvoke(inputToOperateOn, inputToOperateOn, Array.Empty<object>());
|
||||
delayedScriptBlock.Value._evaluatedArgument = output;
|
||||
}
|
||||
catch (RuntimeException runtimeException)
|
||||
|
|
|
@ -219,17 +219,17 @@ namespace System.Management.Automation.ComInterop
|
|||
|
||||
public FieldInfo[] GetFields(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.EmptyArray<FieldInfo>();
|
||||
return Array.Empty<FieldInfo>();
|
||||
}
|
||||
|
||||
public MemberInfo[] GetMember(string name, BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.EmptyArray<MemberInfo>();
|
||||
return Array.Empty<MemberInfo>();
|
||||
}
|
||||
|
||||
public MemberInfo[] GetMembers(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.EmptyArray<MemberInfo>();
|
||||
return Array.Empty<MemberInfo>();
|
||||
}
|
||||
|
||||
public MethodInfo GetMethod(string name, BindingFlags bindingAttr)
|
||||
|
@ -244,7 +244,7 @@ namespace System.Management.Automation.ComInterop
|
|||
|
||||
public MethodInfo[] GetMethods(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.EmptyArray<MethodInfo>();
|
||||
return Array.Empty<MethodInfo>();
|
||||
}
|
||||
|
||||
public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
|
||||
|
@ -259,7 +259,7 @@ namespace System.Management.Automation.ComInterop
|
|||
|
||||
public PropertyInfo[] GetProperties(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.EmptyArray<PropertyInfo>();
|
||||
return Array.Empty<PropertyInfo>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -104,12 +104,12 @@ namespace System.Management.Automation.ComInterop
|
|||
|
||||
internal virtual IList<string> GetMemberNames(bool dataOnly)
|
||||
{
|
||||
return Utils.EmptyArray<string>();
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
internal virtual IList<KeyValuePair<string, object>> GetMembers(IEnumerable<string> names)
|
||||
{
|
||||
return Utils.EmptyArray<KeyValuePair<string, object>>();
|
||||
return Array.Empty<KeyValuePair<string, object>>();
|
||||
}
|
||||
|
||||
DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Expression parameter)
|
||||
|
|
|
@ -641,7 +641,7 @@ namespace System.Management.Automation.ComInterop
|
|||
if (s_dynamicModule == null)
|
||||
{
|
||||
var attributes = new[] {
|
||||
new CustomAttributeBuilder(typeof(UnverifiableCodeAttribute).GetConstructor(Type.EmptyTypes), Utils.EmptyArray<object>()),
|
||||
new CustomAttributeBuilder(typeof(UnverifiableCodeAttribute).GetConstructor(Type.EmptyTypes), Array.Empty<object>()),
|
||||
// PermissionSet(SecurityAction.Demand, Unrestricted = true)
|
||||
new CustomAttributeBuilder(typeof(PermissionSetAttribute).GetConstructor(new Type[] { typeof(SecurityAction) }),
|
||||
new object[] { SecurityAction.Demand },
|
||||
|
|
|
@ -333,7 +333,7 @@ namespace System.Management.Automation.ComInterop
|
|||
BindingFlags.GetProperty,
|
||||
null,
|
||||
RuntimeCallableWrapper,
|
||||
Utils.EmptyArray<object>(),
|
||||
Array.Empty<object>(),
|
||||
CultureInfo.InvariantCulture
|
||||
);
|
||||
members.Add(new KeyValuePair<string, object>(method.Name, value));
|
||||
|
|
|
@ -150,14 +150,14 @@ namespace System.Management.Automation.ComInterop
|
|||
{
|
||||
if (method.ParamCount == 0)
|
||||
{
|
||||
return BindComInvoke(DynamicMetaObject.EmptyMetaObjects, method, new CallInfo(0), Utils.EmptyArray<bool>(), null, null);
|
||||
return BindComInvoke(DynamicMetaObject.EmptyMetaObjects, method, new CallInfo(0), Array.Empty<bool>(), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
// ComGetMemberBinder does not expect callables. Try to call always.
|
||||
if (!canReturnCallables)
|
||||
{
|
||||
return BindComInvoke(DynamicMetaObject.EmptyMetaObjects, method, new CallInfo(0), Utils.EmptyArray<bool>(), null, null);
|
||||
return BindComInvoke(DynamicMetaObject.EmptyMetaObjects, method, new CallInfo(0), Array.Empty<bool>(), null, null);
|
||||
}
|
||||
|
||||
return new DynamicMetaObject(
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace System.Management.Automation
|
|||
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public Collection<CompletionResult> CompletionMatches { get; set; }
|
||||
|
||||
internal static readonly IList<CompletionResult> EmptyCompletionResult = Utils.EmptyArray<CompletionResult>();
|
||||
internal static readonly IList<CompletionResult> EmptyCompletionResult = Array.Empty<CompletionResult>();
|
||||
private static readonly CommandCompletion s_emptyCommandCompletion = new CommandCompletion(
|
||||
new Collection<CompletionResult>(EmptyCompletionResult), -1, -1, -1);
|
||||
|
||||
|
|
|
@ -1420,7 +1420,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
s_cachedPathExtCollection = pathExt != null
|
||||
? pathExt.Split(Utils.Separators.PathSeparator, StringSplitOptions.RemoveEmptyEntries)
|
||||
: Utils.EmptyArray<string>();
|
||||
: Array.Empty<string>();
|
||||
s_cachedPathExtCollectionWithPs1 = new string[s_cachedPathExtCollection.Length + 1];
|
||||
s_cachedPathExtCollectionWithPs1[0] = StringLiterals.PowerShellScriptFileExtension;
|
||||
Array.Copy(s_cachedPathExtCollection, 0, s_cachedPathExtCollectionWithPs1, 1, s_cachedPathExtCollection.Length);
|
||||
|
|
|
@ -349,7 +349,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
_lookupPathsEnumerator = _lookupPaths.GetEnumerator();
|
||||
_patternEnumerator = _patterns.GetEnumerator();
|
||||
_currentDirectoryResults = Utils.EmptyArray<string>();
|
||||
_currentDirectoryResults = Array.Empty<string>();
|
||||
_currentDirectoryResultsEnumerator = _currentDirectoryResults.GetEnumerator();
|
||||
_justReset = true;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ namespace System.Management.Automation
|
|||
// accessible
|
||||
}
|
||||
|
||||
_currentDirectoryResults = result ?? Utils.EmptyArray<string>();
|
||||
_currentDirectoryResults = result ?? Array.Empty<string>();
|
||||
_currentDirectoryResultsEnumerator = _currentDirectoryResults.GetEnumerator();
|
||||
}
|
||||
|
||||
|
|
|
@ -89,13 +89,13 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
this.ValidationAttributes = validationAttributes == null
|
||||
? Utils.EmptyArray<ValidateArgumentsAttribute>()
|
||||
? Array.Empty<ValidateArgumentsAttribute>()
|
||||
: validationAttributes.ToArray();
|
||||
this.ArgumentTransformationAttributes = argTransformationAttributes == null
|
||||
? Utils.EmptyArray<ArgumentTransformationAttribute>()
|
||||
? Array.Empty<ArgumentTransformationAttribute>()
|
||||
: argTransformationAttributes.ToArray();
|
||||
this.Aliases = aliases == null
|
||||
? Utils.EmptyArray<string>()
|
||||
? Array.Empty<string>()
|
||||
: aliases.ToArray();
|
||||
}
|
||||
|
||||
|
@ -180,12 +180,12 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
this.ValidationAttributes = validationAttributes == null
|
||||
? Utils.EmptyArray<ValidateArgumentsAttribute>()
|
||||
? Array.Empty<ValidateArgumentsAttribute>()
|
||||
: validationAttributes.ToArray();
|
||||
this.ArgumentTransformationAttributes = argTransformationAttributes == null
|
||||
? Utils.EmptyArray<ArgumentTransformationAttribute>()
|
||||
? Array.Empty<ArgumentTransformationAttribute>()
|
||||
: argTransformationAttributes.ToArray();
|
||||
this.Aliases = aliases ?? Utils.EmptyArray<string>();
|
||||
this.Aliases = aliases ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
#endregion ctor
|
||||
|
|
|
@ -1624,7 +1624,7 @@ namespace System.Management.Automation
|
|||
int parametersLength = parameters.Length;
|
||||
if (parametersLength == 0)
|
||||
{
|
||||
return Utils.EmptyArray<object>();
|
||||
return Array.Empty<object>();
|
||||
}
|
||||
|
||||
object[] retValue = new object[parametersLength];
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace System.Management.Automation
|
|||
// 3. We don't need to decide where/when to read the config file for the enabled experimental features,
|
||||
// instead, it will be done when the type is used for the first time, which is always earlier than
|
||||
// any experimental features take effect.
|
||||
string[] enabledFeatures = Utils.EmptyArray<string>();
|
||||
string[] enabledFeatures = Array.Empty<string>();
|
||||
try
|
||||
{
|
||||
enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures();
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = Utils.EmptyArray<string>();
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_verbs = value;
|
||||
|
@ -92,7 +92,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _verbs = Utils.EmptyArray<string>();
|
||||
private string[] _verbs = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the noun parameter to the cmdlet.
|
||||
|
@ -110,7 +110,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = Utils.EmptyArray<string>();
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_nouns = value;
|
||||
|
@ -118,7 +118,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _nouns = Utils.EmptyArray<string>();
|
||||
private string[] _nouns = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PSSnapin/Module parameter to the cmdlet.
|
||||
|
@ -137,7 +137,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = Utils.EmptyArray<string>();
|
||||
value = Array.Empty<string>();
|
||||
}
|
||||
|
||||
_modules = value;
|
||||
|
@ -147,7 +147,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _modules = Utils.EmptyArray<string>();
|
||||
private string[] _modules = Array.Empty<string>();
|
||||
private bool _isModuleSpecified = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -173,7 +173,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private ModuleSpecification[] _moduleSpecifications = Utils.EmptyArray<ModuleSpecification>();
|
||||
private ModuleSpecification[] _moduleSpecifications = Array.Empty<ModuleSpecification>();
|
||||
private bool _isFullyQualifiedModuleSpecified = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1496,7 +1496,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
if (parameterSets == null)
|
||||
{
|
||||
return Utils.EmptyArray<PSObject>();
|
||||
return Array.Empty<PSObject>();
|
||||
}
|
||||
|
||||
List<PSObject> returnParameterSets = new List<PSObject>(cmdInfo.ParameterSets.Count);
|
||||
|
|
|
@ -5342,7 +5342,7 @@ end {
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static bool HasDefaultConstructor(Type type)
|
||||
{
|
||||
return !(type.GetConstructor(PSTypeExtensions.EmptyTypes) == null);
|
||||
return !(type.GetConstructor(Type.EmptyTypes) == null);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
@ -269,7 +269,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (_scripts[0] == null)
|
||||
return;
|
||||
|
||||
var emptyArray = Utils.EmptyArray<object>();
|
||||
var emptyArray = Array.Empty<object>();
|
||||
_scripts[0].InvokeUsingCmdlet(
|
||||
contextCmdlet: this,
|
||||
useLocalScope: false,
|
||||
|
@ -309,7 +309,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
dollarUnder: InputObject,
|
||||
input: new object[] { InputObject },
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (!BlockMethodInLanguageMode(InputObject))
|
||||
{
|
||||
object result = targetMethod.Invoke(Utils.EmptyArray<object>());
|
||||
object result = targetMethod.Invoke(Array.Empty<object>());
|
||||
WriteToPipelineWithUnrolling(result);
|
||||
}
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (_endScript == null)
|
||||
return;
|
||||
|
||||
var emptyArray = Utils.EmptyArray<object>();
|
||||
var emptyArray = Array.Empty<object>();
|
||||
_endScript.InvokeUsingCmdlet(
|
||||
contextCmdlet: this,
|
||||
useLocalScope: false,
|
||||
|
@ -1634,7 +1634,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
dollarUnder: InputObject,
|
||||
input: new object[] { _inputObject },
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
|
||||
if (_toBoolSite.Target.Invoke(_toBoolSite, result))
|
||||
{
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
else
|
||||
{
|
||||
PipelineIterationInfo = Utils.EmptyArray<int>();
|
||||
PipelineIterationInfo = Array.Empty<int>();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -399,7 +399,7 @@ namespace System.Management.Automation
|
|||
/// <remarks>
|
||||
/// All the commands in a given pipeline share the same PipelinePositionInfo.
|
||||
/// </remarks>
|
||||
internal int[] PipelineIterationInfo { get; set; } = Utils.EmptyArray<int>();
|
||||
internal int[] PipelineIterationInfo { get; set; } = Array.Empty<int>();
|
||||
|
||||
/// <summary>
|
||||
/// Adds the information about this informational record to a PSObject as note properties.
|
||||
|
|
|
@ -1757,7 +1757,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
if (valueToConvert != null)
|
||||
{
|
||||
ConstructorInfo toConstructor = resultType.GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
ConstructorInfo toConstructor = resultType.GetConstructor(Type.EmptyTypes);
|
||||
ConvertViaNoArgumentConstructor noArgumentConstructorConverter = new ConvertViaNoArgumentConstructor(toConstructor, resultType);
|
||||
return noArgumentConstructorConverter.Convert(PSObject.Base(valueToConvert), resultType, recursion, (PSObject)valueToConvert, formatProvider, null, ignoreUnknownMembers);
|
||||
}
|
||||
|
@ -5005,7 +5005,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
Type actualResultType = typeof(PSObject);
|
||||
|
||||
ConstructorInfo resultConstructor = actualResultType.GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
ConstructorInfo resultConstructor = actualResultType.GetConstructor(Type.EmptyTypes);
|
||||
|
||||
var converterObj = new ConvertViaNoArgumentConstructor(resultConstructor, actualResultType);
|
||||
return CacheConversion(fromType, toType, converterObj.Convert, ConversionRank.Language);
|
||||
|
@ -5441,7 +5441,7 @@ namespace System.Management.Automation
|
|||
ConstructorInfo toConstructor = null;
|
||||
try
|
||||
{
|
||||
toConstructor = toType.GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
toConstructor = toType.GetConstructor(Type.EmptyTypes);
|
||||
}
|
||||
catch (AmbiguousMatchException e)
|
||||
{
|
||||
|
@ -5663,7 +5663,7 @@ namespace System.Management.Automation
|
|||
// If the ToType has a constructor that takes a hashtable or OrderedDictionary,
|
||||
// then it would have been returned as the constructor during FigureConstructorConversion
|
||||
// So, we need to check only for the first condition
|
||||
ConstructorInfo resultConstructor = toType.GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
ConstructorInfo resultConstructor = toType.GetConstructor(Type.EmptyTypes);
|
||||
|
||||
if (resultConstructor != null || (toType.IsValueType && !toType.IsPrimitive))
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[Parameter(ParameterSetName = ParameterSet_ViaCimSession, Mandatory = true, ValueFromPipeline = true, Position = 0)]
|
||||
[ValidateTrustedData]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Cmdlets use arrays for parameters.")]
|
||||
public string[] Name { set; get; } = Utils.EmptyArray<string>();
|
||||
public string[] Name { set; get; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// This parameter specifies the current pipeline object.
|
||||
|
@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return _functionImportList; }
|
||||
}
|
||||
|
||||
private string[] _functionImportList = Utils.EmptyArray<string>();
|
||||
private string[] _functionImportList = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// This patterns matching the names of cmdlets to import from the module...
|
||||
|
@ -153,7 +153,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return _cmdletImportList; }
|
||||
}
|
||||
|
||||
private string[] _cmdletImportList = Utils.EmptyArray<string>();
|
||||
private string[] _cmdletImportList = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// This parameter specifies the variables to import from the module...
|
||||
|
@ -316,7 +316,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[Parameter(ParameterSetName = ParameterSet_ModuleInfo, Mandatory = true, ValueFromPipeline = true, Position = 0)]
|
||||
[ValidateTrustedData]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Cmdlets use arrays for parameters.")]
|
||||
public PSModuleInfo[] ModuleInfo { set; get; } = Utils.EmptyArray<PSModuleInfo>();
|
||||
public PSModuleInfo[] ModuleInfo { set; get; } = Array.Empty<PSModuleInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// The arguments to pass to the module script.
|
||||
|
|
|
@ -1065,7 +1065,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
// Make sure we always return a non-null collection.
|
||||
return allModules ?? Utils.EmptyArray<PSModuleInfo>();
|
||||
return allModules ?? Array.Empty<PSModuleInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -5732,7 +5732,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
scriptThis: AutomationNull.Value,
|
||||
outputPipe: ((MshCommandRuntime)this.CommandRuntime).OutputPipe,
|
||||
invocationInfo: invocationInfo,
|
||||
args: this.BaseArgumentList ?? Utils.EmptyArray<object>());
|
||||
args: this.BaseArgumentList ?? Array.Empty<object>());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace System.Management.Automation
|
|||
scriptThis: AutomationNull.Value,
|
||||
outputPipe: outputPipe,
|
||||
invocationInfo: invocationInfo,
|
||||
args: arguments ?? Utils.EmptyArray<object>());
|
||||
args: arguments ?? Array.Empty<object>());
|
||||
}
|
||||
catch (ExitException ee)
|
||||
{
|
||||
|
@ -879,7 +879,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
catch (PSInvalidOperationException) { }
|
||||
|
||||
return Utils.EmptyArray<ExperimentalFeature>();
|
||||
return Array.Empty<ExperimentalFeature>();
|
||||
}
|
||||
|
||||
// The extensions of all of the files that can be processed with Import-Module, put the ni.dll in front of .dll to have higher priority to be loaded.
|
||||
|
|
|
@ -266,8 +266,8 @@ namespace System.Management.Automation.Internal
|
|||
subdirectories = Directory.GetDirectories(directoryToCheck, "*", options);
|
||||
ProcessPossibleVersionSubdirectories(subdirectories, versionDirectories);
|
||||
}
|
||||
catch (IOException) { subdirectories = Utils.EmptyArray<string>(); }
|
||||
catch (UnauthorizedAccessException) { subdirectories = Utils.EmptyArray<string>(); }
|
||||
catch (IOException) { subdirectories = Array.Empty<string>(); }
|
||||
catch (UnauthorizedAccessException) { subdirectories = Array.Empty<string>(); }
|
||||
|
||||
bool isModuleDirectory = false;
|
||||
string proposedModuleName = Path.GetFileName(directoryToCheck);
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return _functionImportList; }
|
||||
}
|
||||
|
||||
private string[] _functionImportList = Utils.EmptyArray<string>();
|
||||
private string[] _functionImportList = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// This parameter specifies the patterns matching the cmdlets to import from the module...
|
||||
|
@ -106,7 +106,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return _cmdletImportList; }
|
||||
}
|
||||
|
||||
private string[] _cmdletImportList = Utils.EmptyArray<string>();
|
||||
private string[] _cmdletImportList = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// This parameter causes the session state instance to be written...
|
||||
|
|
|
@ -660,7 +660,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
get
|
||||
{
|
||||
byte[] rawFileData = GetPropertyValue<byte[]>(_baseObject, "moduleManifestFileData", Utils.EmptyArray<byte>());
|
||||
byte[] rawFileData = GetPropertyValue<byte[]>(_baseObject, "moduleManifestFileData", Array.Empty<byte>());
|
||||
return new CimModuleManifestFile(this.ModuleName + ".psd1", rawFileData);
|
||||
}
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ namespace System.Management.Automation
|
|||
|
||||
internal override byte[] RawFileDataCore
|
||||
{
|
||||
get { return GetPropertyValue<byte[]>(_baseObject, "FileData", Utils.EmptyArray<byte>()); }
|
||||
get { return GetPropertyValue<byte[]>(_baseObject, "FileData", Array.Empty<byte>()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -851,9 +851,9 @@ namespace System.Management.Automation
|
|||
IEnumerable<string> typesToProcess,
|
||||
IEnumerable<string> formatsToProcess)
|
||||
{
|
||||
nestedModules = nestedModules ?? Utils.EmptyArray<string>();
|
||||
typesToProcess = typesToProcess ?? Utils.EmptyArray<string>();
|
||||
formatsToProcess = formatsToProcess ?? Utils.EmptyArray<string>();
|
||||
nestedModules = nestedModules ?? Array.Empty<string>();
|
||||
typesToProcess = typesToProcess ?? Array.Empty<string>();
|
||||
formatsToProcess = formatsToProcess ?? Array.Empty<string>();
|
||||
|
||||
var newManifest = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
newManifest["NestedModules"] = nestedModules;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return _name; }
|
||||
}
|
||||
|
||||
private string[] _name = Utils.EmptyArray<string>();
|
||||
private string[] _name = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// This parameter specifies the current pipeline object.
|
||||
|
@ -57,7 +57,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return _moduleInfo; }
|
||||
}
|
||||
|
||||
private PSModuleInfo[] _moduleInfo = Utils.EmptyArray<PSModuleInfo>();
|
||||
private PSModuleInfo[] _moduleInfo = Array.Empty<PSModuleInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// If provided, this parameter will allow readonly modules to be removed.
|
||||
|
|
|
@ -2199,7 +2199,7 @@ namespace System.Management.Automation
|
|||
/// An empty array that is declared statically so we don't keep
|
||||
/// allocating them over and over...
|
||||
/// </summary>
|
||||
internal static object[] StaticEmptyArray = Utils.EmptyArray<object>();
|
||||
internal static object[] StaticEmptyArray = Array.Empty<object>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error pipe.
|
||||
|
|
|
@ -1856,7 +1856,7 @@ namespace System.Management.Automation
|
|||
dollarUnder: AutomationNull.Value,
|
||||
input: AutomationNull.Value,
|
||||
scriptThis: scriptThis,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace System.Management.Automation
|
|||
internal event EventHandler<GettingValueExceptionEventArgs> GettingValueException;
|
||||
|
||||
internal PSObjectPropertyDescriptor(string propertyName, Type propertyType, bool isReadOnly, AttributeCollection propertyAttributes)
|
||||
: base(propertyName, Utils.EmptyArray<Attribute>())
|
||||
: base(propertyName, Array.Empty<Attribute>())
|
||||
{
|
||||
IsReadOnly = isReadOnly;
|
||||
Attributes = propertyAttributes;
|
||||
|
|
|
@ -1488,7 +1488,7 @@ namespace System.Management.Automation.Runspaces
|
|||
UpdateKey();
|
||||
}
|
||||
|
||||
internal static readonly ConsolidatedString Empty = new ConsolidatedString(Utils.EmptyArray<string>());
|
||||
internal static readonly ConsolidatedString Empty = new ConsolidatedString(Array.Empty<string>());
|
||||
|
||||
internal static IEqualityComparer<ConsolidatedString> EqualityComparer = new ConsolidatedStringEqualityComparer();
|
||||
|
||||
|
|
|
@ -1212,26 +1212,15 @@ namespace System.Management.Automation
|
|||
return commandName;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static T[] EmptyArray<T>()
|
||||
{
|
||||
return EmptyArrayHolder<T>._instance;
|
||||
}
|
||||
|
||||
internal static ReadOnlyCollection<T> EmptyReadOnlyCollection<T>()
|
||||
{
|
||||
return EmptyReadOnlyCollectionHolder<T>._instance;
|
||||
}
|
||||
|
||||
private static class EmptyArrayHolder<T>
|
||||
{
|
||||
internal static readonly T[] _instance = new T[0];
|
||||
}
|
||||
|
||||
private static class EmptyReadOnlyCollectionHolder<T>
|
||||
{
|
||||
internal static readonly ReadOnlyCollection<T> _instance =
|
||||
new ReadOnlyCollection<T>(EmptyArray<T>());
|
||||
new ReadOnlyCollection<T>(Array.Empty<T>());
|
||||
}
|
||||
|
||||
internal static class Separators
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace System.Management.Automation
|
|||
// implement a "trigger once" breakpoint that disables itself after first hit.
|
||||
// One could also share an action across many breakpoints - and hence needs
|
||||
// to know something about the breakpoint that is hit, e.g. in a poor mans code coverage tool.
|
||||
Action.DoInvoke(dollarUnder: this, input: null, args: Utils.EmptyArray<object>());
|
||||
Action.DoInvoke(dollarUnder: this, input: null, args: Array.Empty<object>());
|
||||
}
|
||||
catch (BreakException)
|
||||
{
|
||||
|
|
|
@ -297,7 +297,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
if (count == 0 || _countEntriesInBuffer == 0)
|
||||
{
|
||||
return Utils.EmptyArray<HistoryInfo>();
|
||||
return Array.Empty<HistoryInfo>();
|
||||
}
|
||||
|
||||
lock (_syncRoot)
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace System.Management.Automation.Interpreter
|
|||
int stackDepth = 0;
|
||||
int continuationsDepth = 0;
|
||||
|
||||
var cookieEnumerator = (debugCookies ?? Automation.Utils.EmptyArray<KeyValuePair<int, object>>()).GetEnumerator();
|
||||
var cookieEnumerator = (debugCookies ?? Array.Empty<KeyValuePair<int, object>>()).GetEnumerator();
|
||||
var hasCookie = cookieEnumerator.MoveNext();
|
||||
|
||||
for (int i = 0; i < instructions.Count; i++)
|
||||
|
|
|
@ -288,7 +288,7 @@ namespace System.Management.Automation.Interpreter
|
|||
|
||||
private readonly LightCompiler _parent;
|
||||
|
||||
private static LocalDefinition[] s_emptyLocals = Automation.Utils.EmptyArray<LocalDefinition>();
|
||||
private static LocalDefinition[] s_emptyLocals = Array.Empty<LocalDefinition>();
|
||||
|
||||
public LightCompiler(int compilationThreshold)
|
||||
{
|
||||
|
|
|
@ -682,7 +682,7 @@ namespace System.Management.Automation.Interpreter
|
|||
internal class ThreadLocal<T>
|
||||
{
|
||||
private StorageInfo[] _stores; // array of storage indexed by managed thread ID
|
||||
private static readonly StorageInfo[] s_updating = Automation.Utils.EmptyArray<StorageInfo>(); // a marker used when updating the array
|
||||
private static readonly StorageInfo[] s_updating = Array.Empty<StorageInfo>(); // a marker used when updating the array
|
||||
private readonly bool _refCounted;
|
||||
|
||||
public ThreadLocal()
|
||||
|
|
|
@ -990,7 +990,7 @@ namespace System.Management.Automation
|
|||
dollarUnder: match,
|
||||
input: AutomationNull.Value,
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: Utils.EmptyArray<object>());
|
||||
args: Array.Empty<object>());
|
||||
|
||||
return PSObject.ToStringParser(context, result);;
|
||||
};
|
||||
|
|
|
@ -33,9 +33,9 @@ namespace System.Management.Automation.Language
|
|||
internal const BindingFlags instancePublicFlags = BindingFlags.Instance | BindingFlags.Public;
|
||||
|
||||
internal static readonly ConstructorInfo ObjectList_ctor =
|
||||
typeof(List<object>).GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
typeof(List<object>).GetConstructor(Type.EmptyTypes);
|
||||
internal static readonly MethodInfo ObjectList_ToArray =
|
||||
typeof(List<object>).GetMethod(nameof(List<object>.ToArray), PSTypeExtensions.EmptyTypes);
|
||||
typeof(List<object>).GetMethod(nameof(List<object>.ToArray), Type.EmptyTypes);
|
||||
|
||||
internal static readonly MethodInfo ArrayOps_GetMDArrayValue =
|
||||
typeof(ArrayOps).GetMethod(nameof(ArrayOps.GetMDArrayValue), staticFlags);
|
||||
|
@ -778,7 +778,7 @@ namespace System.Management.Automation.Language
|
|||
|
||||
private IEnumerable<Expression> CompileInvocationArguments(IEnumerable<ExpressionAst> arguments)
|
||||
{
|
||||
return arguments == null ? Utils.EmptyArray<Expression>() : arguments.Select(CompileExpressionOperand);
|
||||
return arguments == null ? Array.Empty<Expression>() : arguments.Select(CompileExpressionOperand);
|
||||
}
|
||||
|
||||
internal Expression ReduceAssignment(ISupportsAssignment left, TokenKind tokenKind, Expression right)
|
||||
|
@ -1266,7 +1266,7 @@ namespace System.Management.Automation.Language
|
|||
OutputTypeAttribute result;
|
||||
if (ast.PositionalArguments.Count == 0)
|
||||
{
|
||||
result = new OutputTypeAttribute(Utils.EmptyArray<string>());
|
||||
result = new OutputTypeAttribute(Array.Empty<string>());
|
||||
}
|
||||
else if (ast.PositionalArguments.Count == 1)
|
||||
{
|
||||
|
@ -3726,7 +3726,7 @@ namespace System.Management.Automation.Language
|
|||
|
||||
internal static Expression CreateThrow(Type resultType, Type exception, params object[] exceptionArgs)
|
||||
{
|
||||
Type[] argTypes = PSTypeExtensions.EmptyTypes;
|
||||
Type[] argTypes = Type.EmptyTypes;
|
||||
if (exceptionArgs != null)
|
||||
{
|
||||
argTypes = new Type[exceptionArgs.Length];
|
||||
|
@ -5914,7 +5914,7 @@ namespace System.Management.Automation.Language
|
|||
}
|
||||
|
||||
return InvokeMemberExpressionAst.Arguments == null
|
||||
? Utils.EmptyArray<Expression>()
|
||||
? Array.Empty<Expression>()
|
||||
: (InvokeMemberExpressionAst.Arguments.Select(compiler.Compile)).ToArray();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace System.Management.Automation.Language
|
|||
|
||||
private static int s_globalCounter = 0;
|
||||
private static readonly CustomAttributeBuilder s_hiddenCustomAttributeBuilder =
|
||||
new CustomAttributeBuilder(typeof(HiddenAttribute).GetConstructor(Type.EmptyTypes), Utils.EmptyArray<object>());
|
||||
new CustomAttributeBuilder(typeof(HiddenAttribute).GetConstructor(Type.EmptyTypes), Array.Empty<object>());
|
||||
|
||||
private static readonly string s_sessionStateKeeperFieldName = "__sessionStateKeeper";
|
||||
internal static readonly string SessionStateFieldName = "__sessionState";
|
||||
|
@ -765,7 +765,7 @@ namespace System.Management.Automation.Language
|
|||
var parameters = ((IParameterMetadataProvider)functionMemberAst).Parameters;
|
||||
if (parameters == null)
|
||||
{
|
||||
return PSTypeExtensions.EmptyTypes;
|
||||
return Type.EmptyTypes;
|
||||
}
|
||||
|
||||
bool anyErrors = false;
|
||||
|
@ -1279,7 +1279,7 @@ namespace System.Management.Automation.Language
|
|||
private static IEnumerable<CustomAttributeBuilder> GetAssemblyAttributeBuilders(string scriptFile)
|
||||
{
|
||||
var ctor = typeof(DynamicClassImplementationAssemblyAttribute).GetConstructor(Type.EmptyTypes);
|
||||
var emptyArgs = Utils.EmptyArray<object>();
|
||||
var emptyArgs = Array.Empty<object>();
|
||||
|
||||
if (string.IsNullOrEmpty(scriptFile)) {
|
||||
yield return new CustomAttributeBuilder(ctor, emptyArgs);
|
||||
|
@ -1291,7 +1291,7 @@ namespace System.Management.Automation.Language
|
|||
var propertyArgs = new object[] { scriptFile };
|
||||
|
||||
yield return new CustomAttributeBuilder(ctor, emptyArgs,
|
||||
propertyInfo, propertyArgs, Utils.EmptyArray<FieldInfo>(), emptyArgs);
|
||||
propertyInfo, propertyArgs, Array.Empty<FieldInfo>(), emptyArgs);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace System.Management.Automation.Language
|
|||
var emptyExtent = new EmptyScriptExtent();
|
||||
var errorMsg = string.Format(CultureInfo.CurrentCulture, ParserStrings.FileReadError, e.Message);
|
||||
errors = new[] { new ParseError(emptyExtent, "FileReadError", errorMsg) };
|
||||
tokens = Utils.EmptyArray<Token>();
|
||||
tokens = Array.Empty<Token>();
|
||||
return new ScriptBlockAst(emptyExtent, null, new StatementBlockAst(emptyExtent, null, null), false);
|
||||
}
|
||||
|
||||
|
@ -1792,7 +1792,7 @@ namespace System.Management.Automation.Language
|
|||
nameof(ParserStrings.MissingNamedStatementBlock),
|
||||
ParserStrings.MissingNamedStatementBlock,
|
||||
blockNameToken.Kind.Text());
|
||||
statementBlock = new StatementBlockAst(blockNameToken.Extent, Utils.EmptyArray<StatementAst>(), null);
|
||||
statementBlock = new StatementBlockAst(blockNameToken.Extent, Array.Empty<StatementAst>(), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace System.Management.Automation
|
|||
|
||||
internal class TypeInferenceContext
|
||||
{
|
||||
public static readonly PSTypeName[] EmptyPSTypeNameArray = Utils.EmptyArray<PSTypeName>();
|
||||
public static readonly PSTypeName[] EmptyPSTypeNameArray = Array.Empty<PSTypeName>();
|
||||
private readonly PowerShell _powerShell;
|
||||
|
||||
public TypeInferenceContext()
|
||||
|
@ -1496,13 +1496,13 @@ namespace System.Management.Automation
|
|||
var memberAsStringConst = memberCommandElement as StringConstantExpressionAst;
|
||||
if (memberAsStringConst == null)
|
||||
{
|
||||
return Utils.EmptyArray<PSTypeName>();
|
||||
return Array.Empty<PSTypeName>();
|
||||
}
|
||||
|
||||
var exprType = GetExpressionType(expression, isStatic);
|
||||
if (exprType == null || exprType.Length == 0)
|
||||
{
|
||||
return Utils.EmptyArray<PSTypeName>();
|
||||
return Array.Empty<PSTypeName>();
|
||||
}
|
||||
|
||||
var res = new List<PSTypeName>(10);
|
||||
|
|
|
@ -518,7 +518,7 @@ namespace System.Management.Automation.Language
|
|||
internal class TypeResolutionState
|
||||
{
|
||||
internal static readonly string[] systemNamespace = { "System" };
|
||||
internal static readonly Assembly[] emptyAssemblies = Utils.EmptyArray<Assembly>();
|
||||
internal static readonly Assembly[] emptyAssemblies = Array.Empty<Assembly>();
|
||||
internal static readonly TypeResolutionState UsingSystem = new TypeResolutionState();
|
||||
|
||||
internal readonly string[] namespaces;
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace System.Management.Automation.Language
|
|||
internal abstract object Accept(ICustomAstVisitor visitor);
|
||||
internal abstract AstVisitAction InternalVisit(AstVisitor visitor);
|
||||
|
||||
internal static PSTypeName[] EmptyPSTypeNameArray = Utils.EmptyArray<PSTypeName>();
|
||||
internal static PSTypeName[] EmptyPSTypeNameArray = Array.Empty<PSTypeName>();
|
||||
|
||||
internal bool IsInWorkflow()
|
||||
{
|
||||
|
@ -3458,7 +3458,7 @@ namespace System.Management.Automation.Language
|
|||
StatementAst statement = null;
|
||||
if (type == SpecialMemberFunctionType.DefaultConstructor)
|
||||
{
|
||||
var invokeMemberAst = new BaseCtorInvokeMemberExpressionAst(extent, extent, Utils.EmptyArray<ExpressionAst>());
|
||||
var invokeMemberAst = new BaseCtorInvokeMemberExpressionAst(extent, extent, Array.Empty<ExpressionAst>());
|
||||
statement = new CommandExpressionAst(extent, invokeMemberAst, null);
|
||||
}
|
||||
|
||||
|
@ -3975,7 +3975,7 @@ namespace System.Management.Automation.Language
|
|||
/// </summary>
|
||||
public class DataStatementAst : StatementAst
|
||||
{
|
||||
private static readonly ExpressionAst[] s_emptyCommandsAllowed = Utils.EmptyArray<ExpressionAst>();
|
||||
private static readonly ExpressionAst[] s_emptyCommandsAllowed = Array.Empty<ExpressionAst>();
|
||||
|
||||
/// <summary>
|
||||
/// Construct a data statement.
|
||||
|
@ -4604,7 +4604,7 @@ namespace System.Management.Automation.Language
|
|||
/// </summary>
|
||||
public class SwitchStatementAst : LabeledStatementAst
|
||||
{
|
||||
private static readonly SwitchClause[] s_emptyClauseArray = Utils.EmptyArray<SwitchClause>();
|
||||
private static readonly SwitchClause[] s_emptyClauseArray = Array.Empty<SwitchClause>();
|
||||
|
||||
/// <summary>
|
||||
/// Construct a switch statement.
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace System.Management.Automation
|
|||
/// </returns>
|
||||
public static string Escape(string pattern)
|
||||
{
|
||||
return Escape(pattern, Utils.EmptyArray<char>());
|
||||
return Escape(pattern, Array.Empty<char>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
else
|
||||
{
|
||||
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(PSTypeExtensions.EmptyTypes);
|
||||
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
|
||||
if (!constructor.IsPublic)
|
||||
{
|
||||
string message = string.Format(CultureInfo.CurrentCulture,
|
||||
|
|
|
@ -599,7 +599,7 @@ else
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
file,
|
||||
|
@ -1216,7 +1216,7 @@ else
|
|||
|
||||
if (sessionType == PSSessionType.Workflow)
|
||||
{
|
||||
List<object> modifiedModulePath = new List<object>(modulesToImport ?? Utils.EmptyArray<string>());
|
||||
List<object> modifiedModulePath = new List<object>(modulesToImport ?? Array.Empty<string>());
|
||||
modifiedModulePath.Insert(0, ConfigurationDataFromXML.PSWORKFLOWMODULE);
|
||||
modulesToImport = modifiedModulePath.ToArray();
|
||||
}
|
||||
|
@ -1339,7 +1339,7 @@ else
|
|||
cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.RestartWSManServiceMessageV));
|
||||
|
||||
ScriptBlock restartServiceScript = cmdlet.InvokeCommand.NewScriptBlock(restartWSManFormat);
|
||||
var emptyArray = Utils.EmptyArray<object>();
|
||||
var emptyArray = Array.Empty<object>();
|
||||
restartServiceScript.InvokeUsingCmdlet(
|
||||
contextCmdlet: cmdlet,
|
||||
useLocalScope: true,
|
||||
|
@ -2697,7 +2697,7 @@ else
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
Name,
|
||||
|
@ -2959,7 +2959,7 @@ $args[0] | ForEach-Object {{
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
arguments,
|
||||
|
@ -3533,7 +3533,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
propertiesToUpdate,
|
||||
|
@ -3629,7 +3629,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
runAsCredential.UserName,
|
||||
|
@ -3700,7 +3700,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] { maxIdleTimeOut, idleTimeOut, setMaxIdleTimeoutFirst });
|
||||
|
||||
|
@ -3715,7 +3715,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] { quotas, });
|
||||
}
|
||||
|
@ -3756,7 +3756,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
optionsTable,
|
||||
|
@ -3862,7 +3862,7 @@ Set-PSSessionConfiguration $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
encodedSessionConfigData,
|
||||
|
@ -4525,7 +4525,7 @@ $_ | Enable-PSSessionConfiguration -force $args[0] -sddl $args[1] -isSDDLSpecifi
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: _shellsToEnable,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
_force,
|
||||
|
@ -4546,7 +4546,7 @@ $_ | Enable-PSSessionConfiguration -force $args[0] -sddl $args[1] -isSDDLSpecifi
|
|||
System.Management.Automation.Tracing.Tracer tracer = new System.Management.Automation.Tracing.Tracer();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (string endPointName in Name ?? Utils.EmptyArray<string>())
|
||||
foreach (string endPointName in Name ?? Array.Empty<string>())
|
||||
{
|
||||
sb.Append(endPointName);
|
||||
sb.Append(", ");
|
||||
|
@ -4760,7 +4760,7 @@ $_ | Disable-PSSessionConfiguration -force $args[0] -whatif:$args[1] -confirm:$a
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: _shellsToDisable,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
_force,
|
||||
|
@ -4774,7 +4774,7 @@ $_ | Disable-PSSessionConfiguration -force $args[0] -whatif:$args[1] -confirm:$a
|
|||
System.Management.Automation.Tracing.Tracer tracer = new System.Management.Automation.Tracing.Tracer();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (string endPointName in Name ?? Utils.EmptyArray<string>())
|
||||
foreach (string endPointName in Name ?? Array.Empty<string>())
|
||||
{
|
||||
sb.Append(endPointName);
|
||||
sb.Append(", ");
|
||||
|
@ -5240,7 +5240,7 @@ Enable-PSRemoting -force $args[0] -queryForRegisterDefault $args[1] -captionForR
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
_force,
|
||||
|
@ -5444,7 +5444,7 @@ Disable-PSRemoting -force:$args[0] -queryForSet $args[1] -captionForSet $args[2]
|
|||
useLocalScope: true,
|
||||
errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe,
|
||||
dollarUnder: AutomationNull.Value,
|
||||
input: Utils.EmptyArray<object>(),
|
||||
input: Array.Empty<object>(),
|
||||
scriptThis: AutomationNull.Value,
|
||||
args: new object[] {
|
||||
_force,
|
||||
|
|
|
@ -269,7 +269,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _scriptsToProcess = Utils.EmptyArray<string>();
|
||||
private string[] _scriptsToProcess = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Role definitions for this session configuration (Role name -> Role capability)
|
||||
|
@ -402,7 +402,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _visibleAliases = Utils.EmptyArray<string>();
|
||||
private string[] _visibleAliases = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of visible cmdlets.
|
||||
|
@ -462,7 +462,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _visibleExternalCommands = Utils.EmptyArray<string>();
|
||||
private string[] _visibleExternalCommands = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of providers.
|
||||
|
@ -482,7 +482,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _visibleProviders = Utils.EmptyArray<string>();
|
||||
private string[] _visibleProviders = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of aliases.
|
||||
|
@ -583,7 +583,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _typesToProcess = Utils.EmptyArray<string>();
|
||||
private string[] _typesToProcess = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of format data to process.
|
||||
|
@ -603,7 +603,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _formatsToProcess = Utils.EmptyArray<string>();
|
||||
private string[] _formatsToProcess = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of assemblies to load.
|
||||
|
@ -1291,7 +1291,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _visibleAliases = Utils.EmptyArray<string>();
|
||||
private string[] _visibleAliases = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of visible cmdlets.
|
||||
|
@ -1351,7 +1351,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _visibleExternalCommands = Utils.EmptyArray<string>();
|
||||
private string[] _visibleExternalCommands = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of providers.
|
||||
|
@ -1371,7 +1371,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _visibleProviders = Utils.EmptyArray<string>();
|
||||
private string[] _visibleProviders = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Scripts to process.
|
||||
|
@ -1391,7 +1391,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _scriptsToProcess = Utils.EmptyArray<string>();
|
||||
private string[] _scriptsToProcess = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of aliases.
|
||||
|
@ -1492,7 +1492,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _typesToProcess = Utils.EmptyArray<string>();
|
||||
private string[] _typesToProcess = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of format data to process.
|
||||
|
@ -1512,7 +1512,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private string[] _formatsToProcess = Utils.EmptyArray<string>();
|
||||
private string[] _formatsToProcess = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of assemblies to load.
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
else if (computerNames.Length == 0)
|
||||
{
|
||||
resolvedComputerNames = Utils.EmptyArray<string>();
|
||||
resolvedComputerNames = Array.Empty<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace System.Management.Automation.Remoting
|
|||
// ignore it and dont try to serialize again.
|
||||
if (e != null)
|
||||
{
|
||||
_timeZoneInByteFormat = Utils.EmptyArray<byte>();
|
||||
_timeZoneInByteFormat = Array.Empty<byte>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -804,7 +804,7 @@ namespace System.Management.Automation.Remoting.Client
|
|||
if (this.Type == (uint)WSManDataType.WSMAN_DATA_TYPE_BINARY)
|
||||
return _data;
|
||||
else
|
||||
return Utils.EmptyArray<byte>();
|
||||
return Array.Empty<byte>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace System.Management.Automation.Remoting
|
|||
/// </summary>
|
||||
internal void ExecuteVoidMethod(RemoteHostMethodId methodId)
|
||||
{
|
||||
ExecuteVoidMethod(methodId, Utils.EmptyArray<object>());
|
||||
ExecuteVoidMethod(methodId, Array.Empty<object>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -111,7 +111,7 @@ namespace System.Management.Automation.Remoting
|
|||
/// </summary>
|
||||
internal T ExecuteMethod<T>(RemoteHostMethodId methodId)
|
||||
{
|
||||
return ExecuteMethod<T>(methodId, Utils.EmptyArray<object>());
|
||||
return ExecuteMethod<T>(methodId, Array.Empty<object>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -585,7 +585,7 @@ namespace System.Management.Automation.Language
|
|||
if (target.Value == AutomationNull.Value)
|
||||
{
|
||||
return new DynamicMetaObject(
|
||||
Expression.Call(Expression.Constant(Utils.EmptyArray<object>()), typeof(Array).GetMethod("GetEnumerator")),
|
||||
Expression.Call(Expression.Constant(Array.Empty<object>()), typeof(Array).GetMethod("GetEnumerator")),
|
||||
BindingRestrictions.GetInstanceRestriction(target.Expression, AutomationNull.Value)).WriteToDebugLog(this);
|
||||
}
|
||||
|
||||
|
@ -726,7 +726,7 @@ namespace System.Management.Automation.Language
|
|||
private static IEnumerator AutomationNullRule(CallSite site, object obj)
|
||||
{
|
||||
return obj == AutomationNull.Value
|
||||
? Utils.EmptyArray<object>().GetEnumerator()
|
||||
? Array.Empty<object>().GetEnumerator()
|
||||
: ((CallSite<Func<CallSite, object, IEnumerator>>)site).Update(site, obj);
|
||||
}
|
||||
|
||||
|
@ -805,7 +805,7 @@ namespace System.Management.Automation.Language
|
|||
|
||||
if (target.Value == AutomationNull.Value)
|
||||
{
|
||||
return new DynamicMetaObject(Expression.Constant(Utils.EmptyArray<object>()),
|
||||
return new DynamicMetaObject(Expression.Constant(Array.Empty<object>()),
|
||||
BindingRestrictions.GetInstanceRestriction(target.Expression, AutomationNull.Value)).WriteToDebugLog(this);
|
||||
}
|
||||
|
||||
|
@ -874,7 +874,7 @@ namespace System.Management.Automation.Language
|
|||
var enumerable = PSEnumerableBinder.IsEnumerable(target);
|
||||
if (enumerable == null)
|
||||
{
|
||||
var bindingResult = PSVariableAssignmentBinder.Get().Bind(target, Utils.EmptyArray<DynamicMetaObject>());
|
||||
var bindingResult = PSVariableAssignmentBinder.Get().Bind(target, Array.Empty<DynamicMetaObject>());
|
||||
var restrictions = target.LimitType.IsValueType
|
||||
? bindingResult.Restrictions
|
||||
: target.PSGetTypeRestriction();
|
||||
|
@ -3706,7 +3706,7 @@ namespace System.Management.Automation.Language
|
|||
}
|
||||
|
||||
return errorSuggestion ?? target.ThrowRuntimeError(
|
||||
Utils.EmptyArray<DynamicMetaObject>(),
|
||||
Array.Empty<DynamicMetaObject>(),
|
||||
BindingRestrictions.Empty,
|
||||
"OperatorRequiresNumber",
|
||||
ParserStrings.OperatorRequiresNumber,
|
||||
|
@ -7435,7 +7435,7 @@ namespace System.Management.Automation.Language
|
|||
if (string.Equals(methodName, "Foreach", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var enumerator = (new object[] { obj }).GetEnumerator();
|
||||
return EnumerableOps.ForEach(enumerator, args[0], Utils.EmptyArray<object>());
|
||||
return EnumerableOps.ForEach(enumerator, args[0], Array.Empty<object>());
|
||||
}
|
||||
|
||||
throw InterpreterError.NewInterpreterException(methodName, typeof(RuntimeException), null,
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace System.Management.Automation
|
|||
CmdletBindingAttribute cmdletBindingAttribute = null;
|
||||
if (!Ast.HasAnyScriptBlockAttributes())
|
||||
{
|
||||
attributes = Utils.EmptyArray<Attribute>();
|
||||
attributes = Array.Empty<Attribute>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -963,7 +963,7 @@ namespace System.Management.Automation
|
|||
|
||||
if (args == null)
|
||||
{
|
||||
args = Utils.EmptyArray<object>();
|
||||
args = Array.Empty<object>();
|
||||
}
|
||||
|
||||
bool runOptimized = context._debuggingMode > 0 ? false : createLocalScope;
|
||||
|
@ -1289,7 +1289,7 @@ namespace System.Management.Automation
|
|||
var leftOverArgs = args.Length - parameters.Length;
|
||||
if (leftOverArgs <= 0)
|
||||
{
|
||||
return Utils.EmptyArray<object>();
|
||||
return Array.Empty<object>();
|
||||
}
|
||||
|
||||
object[] result = new object[leftOverArgs];
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace System.Management.Automation.Internal
|
|||
public class ScriptBlockMemberMethodWrapper
|
||||
{
|
||||
/// <summary>Used in codegen</summary>
|
||||
public static readonly object[] _emptyArgumentArray = Utils.EmptyArray<object>(); // See TypeDefiner.DefineTypeHelper.DefineMethodBody
|
||||
public static readonly object[] _emptyArgumentArray = Array.Empty<object>(); // See TypeDefiner.DefineTypeHelper.DefineMethodBody
|
||||
|
||||
/// <summary>
|
||||
/// Indicate the wrapper is for a static member method.
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace System.Management.Automation
|
|||
|
||||
if (args == null)
|
||||
{
|
||||
args = Utils.EmptyArray<object>();
|
||||
args = Array.Empty<object>();
|
||||
}
|
||||
|
||||
// Perform validations on the ScriptBlock. GetSimplePipeline can allow for more than one
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace System.Management.Automation
|
|||
/// </remarks>
|
||||
internal virtual PSObject[] GetParameter(string pattern)
|
||||
{
|
||||
return new PSObject[0];
|
||||
return Array.Empty<PSObject>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -3116,7 +3116,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
case RegistryValueKind.Binary:
|
||||
case RegistryValueKind.Unknown:
|
||||
{
|
||||
defaultValue = new byte[0];
|
||||
defaultValue = Array.Empty<byte>();
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -3135,7 +3135,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
case RegistryValueKind.MultiString:
|
||||
{
|
||||
defaultValue = new string[0];
|
||||
defaultValue = Array.Empty<string>();
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace System.Management.Automation
|
|||
get { return _missingPSSnapIns; }
|
||||
}
|
||||
|
||||
private ReadOnlyCollection<string> _missingPSSnapIns = new ReadOnlyCollection<string>(new string[0]);
|
||||
private ReadOnlyCollection<string> _missingPSSnapIns = new ReadOnlyCollection<string>(Array.Empty<string>());
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the shell.
|
||||
|
|
|
@ -70,11 +70,6 @@ namespace System.Management.Automation
|
|||
/// </summary>
|
||||
internal static partial class PSTypeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Type.EmptyTypes is not in CoreCLR. Use this one to replace it.
|
||||
/// </summary>
|
||||
internal static Type[] EmptyTypes = new Type[0];
|
||||
|
||||
/// <summary>
|
||||
/// Check does the type have an instance default constructor with visibility that allows calling it from subclass.
|
||||
/// </summary>
|
||||
|
|
|
@ -487,12 +487,12 @@ namespace System.Management.Automation
|
|||
#region private
|
||||
|
||||
private string _resourceString;
|
||||
private object[] _args = new object[0];
|
||||
private object[] _args = Array.Empty<object>();
|
||||
private string _commandName;
|
||||
|
||||
private string BuildMessage()
|
||||
{
|
||||
object[] messageArgs = new object[0];
|
||||
object[] messageArgs = Array.Empty<object>();
|
||||
|
||||
if (_args != null)
|
||||
{
|
||||
|
|
|
@ -903,7 +903,7 @@ namespace System.Management.Automation
|
|||
PSTraceSourceOptions.WriteLine,
|
||||
writeLineFormatter,
|
||||
format,
|
||||
Utils.EmptyArray<object>());
|
||||
Array.Empty<object>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue