Mono Class Library: System.Net.WebHeaderCollection Overview | Members

System.Net.WebHeaderCollection.GetValues Method

Returns the values stored in the specified protocol header. [Edit]

public override string[] GetValues (string header)

Parameters

header
A string containing the protocol header name whose values are returned. [Edit]

Returns

An array of string objects that contain the values of the protocol header named header in the current instance. If header is not found in the current instance, returns null . [Edit]

Remarks

Note: This method overrides System.Collections.Specialized.NameValueCollection.GetValues(string).
[Edit]

Example

This example demonstrates the WebHeaderCollection.GetValues(string) method.

C# Example
using System;
using System.Net;

class GetValuesExample
{
   public static void Main()
   {
      Uri contosoUri = new Uri("http://www.contoso.com");
      HttpWebRequest httpContoso = 
         (HttpWebRequest)WebRequest.Create(contosoUri);

      httpContoso.SendChunked=true;
      httpContoso.TransferEncoding="compress";
      httpContoso.TransferEncoding="gzip";
    
      WebHeaderCollection webColl = httpContoso.Headers;
      String[] sAry = webColl.GetValues("Transfer-Encoding");

      Console.WriteLine("Transfer-Encoding:");
      foreach(string s in sAry)
         Console.WriteLine("{0}", s);
   }
}

The output is

Transfer-Encoding:

compress

gzip

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0