Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

HttpMemoryContent

class HttpMemoryContent

Module: System.Web.Http
Assembly: System.Web.dll
Source file: HttpContentTypes.rvn

Inheritance: Object → HttpContent → HttpMemoryContent

Buffered HTTP content retaining a readonly memory window without copying.

Remarks

Readonly is shallow: keep backing bytes unchanged during reads or sends.

Constructors

3 items
HttpMemoryContent(memory: ReadOnlyMemory<byte>, contentType: MediaType) Retains bytes with a validated media type; does not encode or validate the body.
HttpMemoryContent(memory: ReadOnlyMemory<byte>, contentType: string) Retains bytes and an outbound Content-Type.
HttpMemoryContent(memory: ReadOnlyMemory<byte>) Retains the selected bytes without taking exclusive ownership.

Properties

3 items
IsBuffered: bool True when content already has a complete byte sequence. Inherited from HttpContent.IsBuffered
Length: int Declared byte count, or -1 for incoming chunked/close-delimited content. Inherited from HttpContent.Length
Memory: ReadOnlyMemory<byte> The retained readonly window. Other aliases may modify its backing storage.

Methods

8 items
CopyTo(destination: OutputStream, cancellationToken?: CancellationToken) -> Task<Result<void, HttpError>> Copies buffered or streaming content with bounded staging and backpressure. Inherited from HttpContent.CopyTo
Dispose() -> () Releases owned stream content; borrowed sources remain open. Idempotent. Inherited from HttpContent.Dispose · Implements Disposable.Dispose
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
GetContentType() -> Result<Optional<MediaType>, HttpError> Parses this producer's declared Content-Type without consuming its body. Inherited from HttpContent.GetContentType
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString
TryGetStream() -> Optional<InputStream> Returns the one-shot input stream, or None for buffered content. Does not read. The content owns the stream unless HttpStreamContent.Create was passed leaveOpen=true. Inherited from HttpContent.TryGetStream