FileWebRequest.ContentLength Właściwość

Definicja

Pobiera lub ustawia długość zawartości wysyłanych danych.

public:
 virtual property long ContentLength { long get(); void set(long value); };
public override long ContentLength { get; set; }
member this.ContentLength : int64 with get, set
Public Overrides Property ContentLength As Long

Wartość właściwości

Liczba bajtów wysyłanych danych żądania.

Wyjątki

ContentLength wartość jest mniejsza niż 0.

Przykłady

Poniższy przykład kodu ustawia długość wysyłanej zawartości. Zapoznaj się z kompletnym FileWebRequest przykładem w klasie.

// Set the ContentLength property.
myFileWebRequest->ContentLength = byteArray->Length;
String^ contentLength = myFileWebRequest->ContentLength.ToString();
Console::WriteLine( "\nThe content length is {0}.", contentLength );
// Set the ContentLength property.
myFileWebRequest.ContentLength = byteArray.Length;

string contentLength = myFileWebRequest.ContentLength.ToString ();

Console.WriteLine ("\nThe content length is {0}.", contentLength);
' Set the ContentLength property.
myFileWebRequest.ContentLength = byteArray.Length

Dim contentLength As String = myFileWebRequest.ContentLength.ToString()

Console.WriteLine(ControlChars.Lf + "The content length is {0}.", contentLength)

Dotyczy