共用方式為


FileWebRequest.ContentLength 屬性

定義

取得或設定正在傳送之資料的內容長度。

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

屬性值

正在傳送要求資料的位元組數。

例外狀況

範例

下列程式代碼範例會設定所傳送數據的內容長度。 請參閱 類別 FileWebRequest 中的完整範例。

// 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)

適用於