Bagikan melalui


HttpRequestCachePolicy.ToString Metode

Definisi

Mengembalikan representasi string dari instans ini.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Mengembalikan

String Nilai yang berisi nilai properti untuk instans ini.

Contoh

Contoh kode berikut menunjukkan panggilan metode ini.

static WebResponse^ GetResponseUsingDefaultCache( Uri^ uri )
{
   // Set a cache policy level for the "http:" scheme.
   HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::Default );

   // Create the request.
   WebRequest^ request = WebRequest::Create( uri );
   request->CachePolicy = policy;
   WebResponse^ response = request->GetResponse();
   Console::WriteLine( L"Policy {0}.", policy );
   Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache );
   return response;
}
public static WebResponse GetResponseUsingDefaultCache(Uri uri)
{
    // Set a cache policy level for the "http:" scheme.
    HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default);
    // Create the request.
    WebRequest request = WebRequest.Create(uri);
    request.CachePolicy = policy;
    WebResponse response = request.GetResponse();
    Console.WriteLine("Policy {0}.", policy.ToString());
    Console.WriteLine("Is the response from the cache? {0}", response.IsFromCache);
    return response;
}

Keterangan

String berisi label yang mengidentifikasi properti , diikuti dengan titik dua (":") dan nilai . Properti dipisahkan oleh satu spasi.

Berlaku untuk