Repository: PowerShell/PowerShell
File: src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs (C#)

Code before:
        /// </summary>
        public MemoryStream RawContentStream { get; protected set; }

        /// <summary>
        /// Gets the RelationLink property.
        /// </summary>
        public Dictionary<string, string>? RelationLink { get; internal set; }

        /// <summary>
        /// Gets the response status code.
        /// </summary>
        public int StatusCode => WebResponseHelper.GetStatusCode(BaseResponse);

        /// <summary>
        /// Gets the response status description.
        /// </summary>
        public string StatusDescription => WebResponseHelper.GetStatusDescription(BaseResponse);

        #endregion Properties

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="WebResponseObject"/> class.
        /// </summary>
        /// <param name="response">The Http response.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        public WebResponseObject(HttpResponseMessage response, CancellationToken cancellationToken) : this(response, null, cancellationToken) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="WebResponseObject"/> class
        /// with the specified <paramref name="contentStream"/>.
        /// </summary>
        /// <param name="response">Http response.</param>
        /// <param name="contentStream">The http content stream.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        public WebResponseObject(HttpResponseMessage response, Stream? contentStream, CancellationToken cancellationToken)
        {
            SetResponse(response, contentStream, cancellationToken);
            InitializeContent();
            InitializeRawContent(response);
        }

        #endregion Constructors

        #region Methods

        /// <summary>
        /// Reads the response content from the web response.
        /// </summary>
        private void InitializeContent()

Review comment (performance):
@stevenebutler why did you choose `perReadMillisecondsTimeout` instead of something like `_perReadTimeout` ?
Maybe you can cache `perReadTimeout = NetworkTimeout` directly in `WebRequestPSCmdlet.Common.cs`

Code after:
        /// </summary>
        public MemoryStream RawContentStream { get; protected set; }

        /// <summary>
        /// Gets the RelationLink property.
        /// </summary>
        public Dictionary<string, string>? RelationLink { get; internal set; }

        /// <summary>
        /// Gets the response status code.
        /// </summary>
        public int StatusCode => WebResponseHelper.GetStatusCode(BaseResponse);

        /// <summary>
        /// Gets the response status description.
        /// </summary>
        public string StatusDescription => WebResponseHelper.GetStatusDescription(BaseResponse);

        #endregion Properties

        #region Protected Fields

        /// <summary>
        /// Time permitted between reads or Timeout.InfiniteTimeSpan for no timeout.
        /// </summary>
        protected TimeSpan perReadTimeout;

        #endregion Protected Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="WebResponseObject"/> class.
        /// </summary>
        /// <param name="response">The Http response.</param>
        /// <param name="perReadTimeout">Time permitted between reads or Timeout.InfiniteTimeSpan for no timeout.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        public WebResponseObject(HttpResponseMessage response, TimeSpan perReadTimeout, CancellationToken cancellationToken) : this(response, null, perReadTimeout, cancellationToken) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="WebResponseObject"/> class
        /// with the specified <paramref name="contentStream"/>.
        /// </summary>
        /// <param name="response">Http response.</param>
        /// <param name="contentStream">The http content stream.</param>
        /// <param name="perReadTimeout">Time permitted between reads or Timeout.InfiniteTimeSpan for no timeout.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        public WebResponseObject(HttpResponseMessage response, Stream? contentStream, TimeSpan perReadTimeout, CancellationToken cancellationToken)
        {
            this.perReadTimeout = perReadTimeout;
            SetResponse(response, contentStream, cancellationToken);