MultipartContent::TryComputeLength Method (Int64%)

.NET Framework (current version)
 

Determines whether the HTTP multipart content has a valid length in bytes.

Namespace:   System.Net.Http
Assembly:  System.Net.Http (in System.Net.Http.dll)

public protected:
virtual bool TryComputeLength(
	[OutAttribute] long long% length
) override

Parameters

length
Type: System::Int64%

The length in bytes of the HHTP content.

Return Value

Type: System::Boolean

true if length is a valid length; otherwise, false.

The TryComputeLength method gives HTTP multipart content the ability to calculate the content length. This is useful for content types which are able to easily calculate the content length. If computing the content length is not possible or expensive (would require the system to buffer the whole content where the serialization would be expensive or require the system to allocate a lot of memory), this method can return false. If this method returns false, this implies that either chunked transfer is needed or the content must get buffered before being sent to the server.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top
Show: