예제 #1
0
 /// <summary>
 /// Try to get the first value from the specified header name.
 /// </summary>
 /// <param name="self">The headers.</param>
 /// <param name="name">The header's name.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public static bool TryGetValue(this HttpHeaders self, string name, out string value)
 {
     value = null;
     return(self.TryGetValues(name, out IEnumerable <string> values) &&
            (value = values?.FirstOrDefault()) != null);
 }