The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpMultipartContent.TryComputeLength | tryComputeLength method

Applies to Windows and Windows Phone

Determines whether the HttpMultipartContent has a valid length in bytes.


var result = httpMultipartContent.tryComputeLength();
var length = result.length;
var boolean = result.boolean;


length (out parameter)

Type: Number [JavaScript] | System.UInt64 [.NET] | uint64 [C++]

The length in bytes of the HttpMultipartContent.

Return value

Type: Boolean [JavaScript] | System.Boolean [.NET] | Platform::Boolean [C++]

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


The TryComputeLength method calculates the content length for HTTP content in HttpMultipartContent. Headers set on the content are not included in the content length. This is useful for content types that are easy to 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.


Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Web::Http [C++]



See also




© 2014 Microsoft. All rights reserved.