public override string ToString()
 {
     return(_dispositionType + NameValueHeaderValue.ToString(_parameters, ';', true));
 }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            AppendValueIfRequired(sb, _noStore, noStoreString);
            AppendValueIfRequired(sb, _noTransform, noTransformString);
            AppendValueIfRequired(sb, _onlyIfCached, onlyIfCachedString);
            AppendValueIfRequired(sb, _publicField, publicString);
            AppendValueIfRequired(sb, _mustRevalidate, mustRevalidateString);
            AppendValueIfRequired(sb, _proxyRevalidate, proxyRevalidateString);

            if (_noCache)
            {
                AppendValueWithSeparatorIfRequired(sb, noCacheString);
                if ((_noCacheHeaders != null) && (_noCacheHeaders.Count > 0))
                {
                    sb.Append("=\"");
                    AppendValues(sb, _noCacheHeaders);
                    sb.Append('\"');
                }
            }

            if (_maxAge.HasValue)
            {
                AppendValueWithSeparatorIfRequired(sb, maxAgeString);
                sb.Append('=');
                sb.Append(((int)_maxAge.Value.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo));
            }

            if (_sharedMaxAge.HasValue)
            {
                AppendValueWithSeparatorIfRequired(sb, sharedMaxAgeString);
                sb.Append('=');
                sb.Append(((int)_sharedMaxAge.Value.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo));
            }

            if (_maxStale)
            {
                AppendValueWithSeparatorIfRequired(sb, maxStaleString);
                if (_maxStaleLimit.HasValue)
                {
                    sb.Append('=');
                    sb.Append(((int)_maxStaleLimit.Value.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo));
                }
            }

            if (_minFresh.HasValue)
            {
                AppendValueWithSeparatorIfRequired(sb, minFreshString);
                sb.Append('=');
                sb.Append(((int)_minFresh.Value.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo));
            }

            if (_privateField)
            {
                AppendValueWithSeparatorIfRequired(sb, privateString);
                if ((_privateHeaders != null) && (_privateHeaders.Count > 0))
                {
                    sb.Append("=\"");
                    AppendValues(sb, _privateHeaders);
                    sb.Append('\"');
                }
            }

            NameValueHeaderValue.ToString(_extensions, ',', false, sb);

            return(sb.ToString());
        }
Beispiel #3
0
 public override string ToString()
 {
     return(base.ToString() + NameValueHeaderValue.ToString(_parameters, ';', true));
 }