From 483049362f46dc792f5b16c1644b4a0ddbf6ca1e Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 13:50:25 +0500 Subject: [PATCH 1/9] Step 1 --- .../commands/management/WriteContentCommandBase.cs | 4 ++-- .../commands/utility/ConvertTo-Html.cs | 2 +- .../commands/utility/Var.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WriteContentCommandBase.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WriteContentCommandBase.cs index dc1221f81ee..68560bef20f 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WriteContentCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WriteContentCommandBase.cs @@ -333,7 +333,7 @@ private string[] GetAcceptedPaths(string[] unfilteredPaths, CmdletProviderContex { Collection pathInfos = ResolvePaths(unfilteredPaths, true, false, currentContext); - ArrayList paths = new ArrayList(); + var paths = new List(); foreach (PathInfo pathInfo in pathInfos) { @@ -343,7 +343,7 @@ private string[] GetAcceptedPaths(string[] unfilteredPaths, CmdletProviderContex } } - return (string[])paths.ToArray(typeof(string)); + return paths.ToArray(); } #endregion protected members diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs index 1374ce6aa45..432dd5ce5b1 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs @@ -359,7 +359,7 @@ private List ProcessParameter(object[] properties) private void InitializeResolvedNameMshParameters() { // temp list of properties with wildcards resolved - ArrayList resolvedNameProperty = new ArrayList(); + var resolvedNameProperty = new List(); foreach (MshParameter p in _propertyMshParameterList) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs index 08dd6c311be..052f817c305 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs @@ -747,7 +747,7 @@ protected override void ProcessRecord() { if (_valueList == null) { - _valueList = new ArrayList(); + _valueList = new List(); } _valueList.Add(Value); @@ -759,7 +759,7 @@ protected override void ProcessRecord() } } - private ArrayList _valueList; + private List _valueList; /// /// Sets the variable if the name was specified as a formal parameter From 35453239d4d5e03abc3400fb1b86989df4d8a96d Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 15:23:22 +0500 Subject: [PATCH 2/9] Step 2 --- .../host/msh/ConsoleHost.cs | 2 +- .../security/CertificateCommands.cs | 2 +- .../FormatAndOutput/out-console/OutConsole.cs | 6 +++--- src/System.Management.Automation/help/MUIFileSearcher.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 3e657818e99..1af01426fe0 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -2670,7 +2670,7 @@ private void EvaluateSuggestions(ConsoleHostUserInterface ui) // Output any training suggestions try { - ArrayList suggestions = HostUtilities.GetSuggestion(_parent.Runspace); + List suggestions = HostUtilities.GetSuggestion(_parent.Runspace); if (suggestions.Count > 0) { diff --git a/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs b/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs index 39595a5a353..91b2c583818 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateCommands.cs @@ -80,7 +80,7 @@ public string[] LiteralPath // // list of files that were not found // - private ArrayList _filesNotFound = new ArrayList(); + private List _filesNotFound = new List(); /// /// Initializes a new instance of the GetPfxCertificateCommand diff --git a/src/System.Management.Automation/FormatAndOutput/out-console/OutConsole.cs b/src/System.Management.Automation/FormatAndOutput/out-console/OutConsole.cs index d8dca91267b..ef5da004555 100644 --- a/src/System.Management.Automation/FormatAndOutput/out-console/OutConsole.cs +++ b/src/System.Management.Automation/FormatAndOutput/out-console/OutConsole.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections; +using System.Collections.Generic; using System.Management.Automation; using System.Management.Automation.Host; using System.Management.Automation.Internal; @@ -88,7 +88,7 @@ protected override void BeginProcessing() if (Context.CurrentCommandProcessor.CommandRuntime.OutVarList != null) { - _outVarResults = new ArrayList(); + _outVarResults = new List(); } } @@ -162,7 +162,7 @@ protected override void InternalDispose() } } - private ArrayList _outVarResults = null; + private List _outVarResults = null; private IDisposable _transcribeOnlyCookie = null; } diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs index fb31de950c7..354cc9c4d10 100644 --- a/src/System.Management.Automation/help/MUIFileSearcher.cs +++ b/src/System.Management.Automation/help/MUIFileSearcher.cs @@ -118,7 +118,7 @@ private string[] GetFiles(string path, string pattern) #if UNIX // On Linux, file names are case sensitive, so we need to add // extra logic to select the files that match the given pattern. - ArrayList result = new ArrayList(); + var result = new List(); string[] files = Directory.GetFiles(path); var wildcardPattern = WildcardPattern.ContainsWildcardCharacters(pattern) @@ -143,7 +143,7 @@ private string[] GetFiles(string path, string pattern) } } - return (string[])result.ToArray(typeof(string)); + return result.ToArray(); #else return Directory.GetFiles(path, pattern); #endif From 28f03d47b185a87813f9fa5376e5f096f64a15c7 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 15:31:50 +0500 Subject: [PATCH 3/9] Step 3 --- .../engine/hostifaces/HostUtilities.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs index 22f25edb590..63eaa9b8b98 100644 --- a/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs +++ b/src/System.Management.Automation/engine/hostifaces/HostUtilities.cs @@ -72,11 +72,11 @@ public static class HostUtilities $formatString -f [string]::Join(', ', (Get-Command $lastError.TargetObject -UseFuzzyMatch | Select-Object -First 10 -Unique -ExpandProperty Name)) "; - private static ArrayList s_suggestions = InitializeSuggestions(); + private static List s_suggestions = InitializeSuggestions(); - private static ArrayList InitializeSuggestions() + private static List InitializeSuggestions() { - ArrayList suggestions = new ArrayList( + var suggestions = new List( new Hashtable[] { NewSuggestion( @@ -307,10 +307,10 @@ internal static string GetMaxLines(string source, int maxLines) return returnValue.ToString(); } - internal static ArrayList GetSuggestion(Runspace runspace) + internal static List GetSuggestion(Runspace runspace) { LocalRunspace localRunspace = runspace as LocalRunspace; - if (localRunspace == null) { return new ArrayList(); } + if (localRunspace == null) { return new List(); } // Get the last value of $? bool questionMarkVariableValue = localRunspace.ExecutionContext.QuestionMarkVariableValue; @@ -320,7 +320,7 @@ internal static ArrayList GetSuggestion(Runspace runspace) HistoryInfo[] entries = history.GetEntries(-1, 1, true); if (entries.Length == 0) - return new ArrayList(); + return new List(); HistoryInfo lastHistory = entries[0]; @@ -363,7 +363,7 @@ internal static ArrayList GetSuggestion(Runspace runspace) Runspace.DefaultRunspace = runspace; } - ArrayList suggestions = null; + List suggestions = null; try { @@ -383,9 +383,9 @@ internal static ArrayList GetSuggestion(Runspace runspace) } [SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")] - internal static ArrayList GetSuggestion(HistoryInfo lastHistory, object lastError, ArrayList errorList) + internal static List GetSuggestion(HistoryInfo lastHistory, object lastError, ArrayList errorList) { - ArrayList returnSuggestions = new ArrayList(); + var returnSuggestions = new List(); PSModuleInfo invocationModule = new PSModuleInfo(true); invocationModule.SessionState.PSVariable.Set("lastHistory", lastHistory); From f204f807863799ce4e72e12dcd3b62466e37a79a Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 16:06:56 +0500 Subject: [PATCH 4/9] Step 4 --- .../remoting/common/WireDataFormat/EncodeAndDecode.cs | 2 +- .../engine/remoting/fanin/InitialSessionStateProvider.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs index 0ab8320853b..6c48e939f43 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs @@ -1912,7 +1912,7 @@ internal static PSEventArgs GetPSEventArgs(PSObject dataAsPSObject) string computerName = GetPropertyValue(dataAsPSObject, RemoteDataNameStrings.PSEventArgsComputerName); Guid runspaceId = GetPropertyValue(dataAsPSObject, RemoteDataNameStrings.PSEventArgsRunspaceId); - ArrayList sourceArgs = new ArrayList(); + var sourceArgs = new List(); foreach (object argument in RemotingDecoder.EnumerateListProperty(dataAsPSObject, RemoteDataNameStrings.PSEventArgsSourceArgs)) { sourceArgs.Add(argument); diff --git a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs index cb20f3e2e18..3c7fd7445c2 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs @@ -1858,7 +1858,7 @@ private void MergeConfigHashIntoConfigHash(IDictionary childConfigHash) { string customizationString = customization.ToString(); - ArrayList customizationValue = new ArrayList(); + var customizationValue = new List(); // First, take all values from the master config table if (_configHash.ContainsKey(customizationString)) @@ -1866,7 +1866,7 @@ private void MergeConfigHashIntoConfigHash(IDictionary childConfigHash) IEnumerable existingValueAsCollection = LanguagePrimitives.GetEnumerable(_configHash[customization]); if (existingValueAsCollection != null) { - foreach (Object value in existingValueAsCollection) + foreach (object value in existingValueAsCollection) { customizationValue.Add(value); } @@ -1881,7 +1881,7 @@ private void MergeConfigHashIntoConfigHash(IDictionary childConfigHash) IEnumerable newValueAsCollection = LanguagePrimitives.GetEnumerable(childConfigHash[customization]); if (newValueAsCollection != null) { - foreach (Object value in newValueAsCollection) + foreach (object value in newValueAsCollection) { customizationValue.Add(value); } From 0ab7407f85584a73f3aa4c8d0e8ddd6d04b14ca6 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 16:28:07 +0500 Subject: [PATCH 5/9] Step 5 --- .../commands/management/GetContentCommand.cs | 15 ++++----------- .../help/HelpErrorTracer.cs | 11 +++++------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs index 16a06ab10f8..91086d1f6e4 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs @@ -338,13 +338,9 @@ private bool ScanForwardsForTail(ContentHolder holder, CmdletProviderContext cur if (ReadCount <= 0 || (ReadCount >= tailResultQueue.Count && ReadCount != 1)) { count = tailResultQueue.Count; - ArrayList outputList = new ArrayList(); - while (tailResultQueue.Count > 0) - { - outputList.Add(tailResultQueue.Dequeue()); - } + // Write out the content as an array of objects - WriteContentObject(outputList.ToArray(), count, holder.PathInfo, currentContext); + WriteContentObject(tailResultQueue.ToArray(), count, holder.PathInfo, currentContext); } else if (ReadCount == 1) { @@ -356,7 +352,7 @@ private bool ScanForwardsForTail(ContentHolder holder, CmdletProviderContext cur { while (tailResultQueue.Count >= ReadCount) { - ArrayList outputList = new ArrayList(); + ArrayList outputList = new ArrayList((int)ReadCount); for (int idx = 0; idx < ReadCount; idx++, count++) outputList.Add(tailResultQueue.Dequeue()); // Write out the content as an array of objects @@ -366,11 +362,8 @@ private bool ScanForwardsForTail(ContentHolder holder, CmdletProviderContext cur int remainder = tailResultQueue.Count; if (remainder > 0) { - ArrayList outputList = new ArrayList(); - for (; remainder > 0; remainder--, count++) - outputList.Add(tailResultQueue.Dequeue()); // Write out the content as an array of objects - WriteContentObject(outputList.ToArray(), count, holder.PathInfo, currentContext); + WriteContentObject(tailResultQueue.ToArray(), count, holder.PathInfo, currentContext); } } } diff --git a/src/System.Management.Automation/help/HelpErrorTracer.cs b/src/System.Management.Automation/help/HelpErrorTracer.cs index 185601e52a9..9e4a07f4882 100644 --- a/src/System.Management.Automation/help/HelpErrorTracer.cs +++ b/src/System.Management.Automation/help/HelpErrorTracer.cs @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Collections; +using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Reflection; namespace System.Management.Automation { @@ -134,7 +133,7 @@ internal HelpErrorTracer(HelpSystem helpSystem) /// /// This tracks all live TraceFrame objects, which forms a stack. /// - private ArrayList _traceFrames = new ArrayList(); + private List _traceFrames = new List(); /// /// This is the API to use for starting a help trace scope. @@ -160,7 +159,7 @@ internal void TraceError(ErrorRecord errorRecord) if (_traceFrames.Count <= 0) return; - TraceFrame traceFrame = (TraceFrame)_traceFrames[_traceFrames.Count - 1]; + TraceFrame traceFrame = _traceFrames[_traceFrames.Count - 1]; traceFrame.TraceError(errorRecord); } @@ -175,7 +174,7 @@ internal void TraceErrors(Collection errorRecords) if (_traceFrames.Count <= 0) return; - TraceFrame traceFrame = (TraceFrame)_traceFrames[_traceFrames.Count - 1]; + TraceFrame traceFrame = _traceFrames[_traceFrames.Count - 1]; traceFrame.TraceErrors(errorRecords); } @@ -185,7 +184,7 @@ internal void PopFrame(TraceFrame traceFrame) if (_traceFrames.Count <= 0) return; - TraceFrame lastFrame = (TraceFrame)_traceFrames[_traceFrames.Count - 1]; + TraceFrame lastFrame = _traceFrames[_traceFrames.Count - 1]; if (lastFrame == traceFrame) { From f28318b99617dc1337b5dd2339e265a620d1ae04 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 17:24:43 +0500 Subject: [PATCH 6/9] Step 6 --- .../engine/remoting/client/remoterunspace.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index 60f101d89f0..e91bad3bf9c 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -32,7 +32,7 @@ internal class RemoteRunspace : Runspace, IDisposable { #region Private Members - private ArrayList _runningPipelines = new ArrayList(); + private List _runningPipelines = new List(); private object _syncRoot = new object(); private RunspaceStateInfo _runspaceStateInfo = new RunspaceStateInfo(RunspaceState.BeforeOpen); private bool _bSessionStateProxyCallInProgress = false; @@ -1522,7 +1522,7 @@ private bool WaitForFinishofPipelines() lock (_syncRoot) { - runningPipelines = (RemotePipeline[])_runningPipelines.ToArray(typeof(RemotePipeline)); + runningPipelines = (RemotePipeline[])_runningPipelines.ToArray(); } if (runningPipelines.Length > 0) From 65320d3f7aa3ae33042455049c700106efd35443 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 17:52:51 +0500 Subject: [PATCH 7/9] Fix Codacy issues --- .../engine/remoting/client/remoterunspace.cs | 2 +- src/System.Management.Automation/help/HelpErrorTracer.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index e91bad3bf9c..086094fc0c1 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -1522,7 +1522,7 @@ private bool WaitForFinishofPipelines() lock (_syncRoot) { - runningPipelines = (RemotePipeline[])_runningPipelines.ToArray(); + runningPipelines = _runningPipelines.ToArray(); } if (runningPipelines.Length > 0) diff --git a/src/System.Management.Automation/help/HelpErrorTracer.cs b/src/System.Management.Automation/help/HelpErrorTracer.cs index 9e4a07f4882..6a2ae124955 100644 --- a/src/System.Management.Automation/help/HelpErrorTracer.cs +++ b/src/System.Management.Automation/help/HelpErrorTracer.cs @@ -133,7 +133,7 @@ internal HelpErrorTracer(HelpSystem helpSystem) /// /// This tracks all live TraceFrame objects, which forms a stack. /// - private List _traceFrames = new List(); + private readonly List _traceFrames = new List(); /// /// This is the API to use for starting a help trace scope. From 0e9857a8f854d662b688be6cfb54bb8636c9541a Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 9 Aug 2019 18:05:31 +0500 Subject: [PATCH 8/9] Step 7 --- .../namespaces/FileSystemContentStream.cs | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs index f18bb477028..e9cfefd50a4 100644 --- a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs +++ b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs @@ -344,7 +344,7 @@ public IList Read(long readCount) s_tracer.WriteLine("blocks requested = {0}", readCount); - ArrayList blocks = new ArrayList(); + var blocks = new List(); bool readToEnd = (readCount <= 0); if (_alreadyDetectEncoding && _reader.BaseStream.Position == 0) @@ -367,19 +367,19 @@ public IList Read(long readCount) if (_usingByteEncoding) { - if (!ReadByteEncoded(waitChanges, blocks, false)) + if (!ReadByteEncoded(waitChanges, blocks, readBackward: false)) break; } else { if (_usingDelimiter || _isRawStream) { - if (!ReadDelimited(waitChanges, blocks, false, _delimiter)) + if (!ReadDelimited(waitChanges, blocks, readBackward: false, _delimiter)) break; } else { - if (!ReadByLine(waitChanges, blocks, false)) + if (!ReadByLine(waitChanges, blocks, readBackward: false)) break; } } @@ -445,7 +445,7 @@ internal void SeekItemsBackward(int backCount) s_tracer.WriteLine("blocks seek backwards = {0}", backCount); - ArrayList blocks = new ArrayList(); + var blocks = new List(); if (_reader != null) { // Make the reader automatically detect the encoding @@ -463,13 +463,18 @@ internal void SeekItemsBackward(int backCount) return; } - StringBuilder builder = new StringBuilder(); - foreach (char character in _delimiter) - { - builder.Insert(0, character); - } + string actualDelimiter = string.Create( + _delimiter.Length, + _delimiter, + (chars, buf) => + { + for (int i = 0, j = buf.Length - 1; i < chars.Length; i++, j--) + { + chars[i] = buf[j]; + } + } + ); - string actualDelimiter = builder.ToString(); long currentBlock = 0; string lastDelimiterMatch = null; @@ -488,14 +493,14 @@ internal void SeekItemsBackward(int backCount) { if (_usingByteEncoding) { - if (!ReadByteEncoded(false, blocks, true)) + if (!ReadByteEncoded(waitChanges: false, blocks, readBackward: true)) break; } else { if (_usingDelimiter) { - if (!ReadDelimited(false, blocks, true, actualDelimiter)) + if (!ReadDelimited(waitChanges: false, blocks, readBackward: true, actualDelimiter)) break; // If the delimiter is at the end of the file, we need to read one more // to get to the right position. For example: @@ -508,7 +513,7 @@ internal void SeekItemsBackward(int backCount) } else { - if (!ReadByLine(false, blocks, true)) + if (!ReadByLine(waitChanges: false, blocks, readBackward: true)) break; } } @@ -553,7 +558,7 @@ internal void SeekItemsBackward(int backCount) } } - private bool ReadByLine(bool waitChanges, ArrayList blocks, bool readBackward) + private bool ReadByLine(bool waitChanges, List blocks, bool readBackward) { // Reading lines as strings string line = readBackward ? _backReader.ReadLine() : _reader.ReadLine(); @@ -581,7 +586,7 @@ private bool ReadByLine(bool waitChanges, ArrayList blocks, bool readBackward) return true; } - private bool ReadDelimited(bool waitChanges, ArrayList blocks, bool readBackward, string actualDelimiter) + private bool ReadDelimited(bool waitChanges, List blocks, bool readBackward, string actualDelimiter) { if (_isRawStream) { @@ -705,7 +710,7 @@ private bool ReadDelimited(bool waitChanges, ArrayList blocks, bool readBackward } } - private bool ReadByteEncoded(bool waitChanges, ArrayList blocks, bool readBack) + private bool ReadByteEncoded(bool waitChanges, List blocks, bool readBackward) { if (_isRawStream) { @@ -738,7 +743,7 @@ private bool ReadByteEncoded(bool waitChanges, ArrayList blocks, bool readBack) } } - if (readBack) + if (readBackward) { if (_stream.Position == 0) { From bf215f6b01b740d0c08df18a4008e2dfdef945cf Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 3 Sep 2019 13:29:51 +0500 Subject: [PATCH 9/9] Use List in GetContentCommand --- .../commands/management/GetContentCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs index 91086d1f6e4..bc1e87042c7 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetContentCommand.cs @@ -352,7 +352,7 @@ private bool ScanForwardsForTail(ContentHolder holder, CmdletProviderContext cur { while (tailResultQueue.Count >= ReadCount) { - ArrayList outputList = new ArrayList((int)ReadCount); + var outputList = new List((int)ReadCount); for (int idx = 0; idx < ReadCount; idx++, count++) outputList.Add(tailResultQueue.Dequeue()); // Write out the content as an array of objects