void UpdateValue(string headerName, string value) { if (headerName.Equals(HDR_CONTENT_TYPE, StringComparison.OrdinalIgnoreCase)) { _contentType = new MediaType(value); } else if (headerName.Equals(HDR_CONTENT_LENGTH, StringComparison.OrdinalIgnoreCase)) { long contentLength; if (long.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out contentLength)) { _contentLength = contentLength; } } else if (headerName.Equals(HDR_CONTENT_DISPOSITION, StringComparison.OrdinalIgnoreCase)) { _contentDisposition = new ContentDispositionHeader(value); } }
void UpdateValue(string headerName, IEnumerable <string> value) { if (headerName.Equals(HDR_CONTENT_TYPE, StringComparison.OrdinalIgnoreCase)) { _contentType = new MediaType(value.First()); } else if (headerName.Equals(HDR_CONTENT_LENGTH, StringComparison.OrdinalIgnoreCase)) { long contentLength; if (long.TryParse(value.First(), NumberStyles.Float, CultureInfo.InvariantCulture, out contentLength)) { _contentLength = contentLength; } } else if (headerName.Equals(HDR_CONTENT_DISPOSITION, StringComparison.OrdinalIgnoreCase)) { _contentDisposition = new ContentDispositionHeader(value.First()); } else if (headerName.Equals(HDR_CONTENT_LOCATION, StringComparison.OrdinalIgnoreCase)) { _contentLocation = new Uri(value.First(), UriKind.RelativeOrAbsolute); } }