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.

HttpResponseHeaderCollection.TryGetValue method

Applies to Windows and Windows Phone

Returns a value that indicates whether a specified key exists in the HttpResponseHeaderCollection. If an item with that key exists, the item is retrieved as an out parameter.


public bool TryGetValue(
  string key, 
  out string value



Type: System.String

The key to check for in the HttpResponseHeaderCollection.

value (out parameter)

Type: System.String

The item, if it exists. Contains null if the item does not exist in the HttpResponseHeaderCollection.

Return value

Type: System.Boolean

true if an item with that key exists in the HttpResponseHeaderCollection; otherwise, false.


The TryGetValue method is available when you need to work with an HTTP header on an HTTP response that doesn't have a strongly-typed class for the HTTP header. If there is a strongly-typed implementation of the HTTP header, then the methods and properties on the strongly-typed class should be used instead of the TryGetValue method.


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]



See also




© 2014 Microsoft