From 53ca84edeca977dbe9eb0ce60943dd0662cfd996 Mon Sep 17 00:00:00 2001 From: CarloToso <105941898+CarloToso@users.noreply.github.com> Date: Wed, 28 Dec 2022 14:56:04 +0100 Subject: [PATCH 1/2] get { return to => --- .../Common/InvokeRestMethodCommand.Common.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs index a6a2a6290b0..f9c6868daf7 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs @@ -32,9 +32,9 @@ public class InvokeRestMethodCommand : WebRequestPSCmdlet [Parameter(ParameterSetName = "StandardMethodNoProxy")] public override WebRequestMethod Method { - get { return base.Method; } + get => base.Method; - set { base.Method = value; } + set => base.Method = value; } /// @@ -46,9 +46,9 @@ public override WebRequestMethod Method [ValidateNotNullOrEmpty] public override string CustomMethod { - get { return base.CustomMethod; } + get => base.CustomMethod; - set { base.CustomMethod = value; } + set => base.CustomMethod = value; } /// @@ -58,9 +58,9 @@ public override string CustomMethod [Alias("FL")] public SwitchParameter FollowRelLink { - get { return base._followRelLink; } + get => base._followRelLink; - set { base._followRelLink = value; } + set => base._followRelLink = value; } /// @@ -71,9 +71,9 @@ public SwitchParameter FollowRelLink [ValidateRange(1, int.MaxValue)] public int MaximumFollowRelLink { - get { return base._maximumFollowRelLink; } + get => base._maximumFollowRelLink; - set { base._maximumFollowRelLink = value; } + set => base._maximumFollowRelLink = value; } /// @@ -401,18 +401,15 @@ public override void Flush() _streamBuffer.SetLength(0); } - public override long Length - { - get { return _length; } - } + public override long Length => _length; private long _length; public override long Position { - get { return _streamBuffer.Position; } + get => _streamBuffer.Position; - set { _streamBuffer.Position = value; } + set => _streamBuffer.Position = value; } public override int Read(byte[] buffer, int offset, int count) From ce0b973f51fefcdad9157ba8cb1d5131cfb62d05 Mon Sep 17 00:00:00 2001 From: CarloToso <105941898+CarloToso@users.noreply.github.com> Date: Wed, 28 Dec 2022 15:02:38 +0100 Subject: [PATCH 2/2] remove unnecessary () --- .../utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs index f9c6868daf7..a2418efbb86 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs @@ -417,8 +417,7 @@ public override int Read(byte[] buffer, int offset, int count) long previousPosition = Position; bool consumedStream = false; int totalCount = count; - while ((!consumedStream) && - ((Position + totalCount) > _streamBuffer.Length)) + while (!consumedStream && (Position + totalCount) > _streamBuffer.Length) { // If we don't have enough data to fill this from memory, cache more. // We try to read 4096 bytes from base stream every time, so at most we