/// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string ParseMediaType(string type)
        {
            foreach (string mime in DataWriterProvider.SplitTrim(type, ';'))
            {
                // only return first part
                return(mime);
            }

            // if no parts then was empty
            return(String.Empty);
        }
 public static string ParseMediaType(string type)
 {
     using (IEnumerator <string> enumerator = DataWriterProvider.SplitTrim(type, ';').GetEnumerator())
     {
         if (enumerator.MoveNext())
         {
             return(enumerator.Current);
         }
     }
     return(string.Empty);
 }
        public static IEnumerable <string> ParseHeaders(string accept, string contentType)
        {
            string mime;

            foreach (string type in DataWriterProvider.SplitTrim(accept, ','))
            {
                mime = DataWriterProvider.ParseMediaType(type);
                if (!string.IsNullOrEmpty(mime))
                {
                    yield return(mime);
                }
            }
            mime = DataWriterProvider.ParseMediaType(contentType);
            if (!string.IsNullOrEmpty(mime))
            {
                yield return(mime);
            }
            yield break;
        }
        /// <summary>
        /// Parses HTTP headers for Media-Types
        /// </summary>
        /// <param name="accept">HTTP Accept header</param>
        /// <param name="contentType">HTTP Content-Type header</param>
        /// <returns>sequence of Media-Types</returns>
        /// <remarks>
        /// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
        /// </remarks>
        public static IEnumerable <string> ParseHeaders(string accept, string contentType)
        {
            string mime;

            // check for a matching accept type
            foreach (string type in DataWriterProvider.SplitTrim(accept, ','))
            {
                mime = DataWriterProvider.ParseMediaType(type);
                if (!String.IsNullOrEmpty(mime))
                {
                    yield return(mime);
                }
            }

            // fallback on content-type
            mime = DataWriterProvider.ParseMediaType(contentType);
            if (!String.IsNullOrEmpty(mime))
            {
                yield return(mime);
            }
        }
            public bool MoveNext()
            {
                uint num = (uint)this.PC;

                this.PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0:
                    this.s_4__0 = DataWriterProvider.SplitTrim(this.accept, ',').GetEnumerator();
                    num         = 0xfffffffd;
                    break;

                case 1:
                    break;

                case 2:
                    goto Label_0106;

                default:
                    goto Label_010D;
                }
                try
                {
                    while (this.s_4__0.MoveNext())
                    {
                        this.type__1 = this.s_4__0.Current;
                        this.mime__2 = DataWriterProvider.ParseMediaType(this.type__1);
                        if (!string.IsNullOrEmpty(this.mime__2))
                        {
                            this.current = this.mime__2;
                            this.PC      = 1;
                            flag         = true;
                            goto Label_010F;
                        }
                    }
                }
                finally
                {
                    if (!flag)
                    {
                    }
                    if (this.s_4__0 == null)
                    {
                    }
                    this.s_4__0.Dispose();
                }
                this.mime__2 = DataWriterProvider.ParseMediaType(this.contentType);
                if (!string.IsNullOrEmpty(this.mime__2))
                {
                    this.current = this.mime__2;
                    this.PC      = 2;
                    goto Label_010F;
                }
Label_0106:
                this.PC = -1;
Label_010D:
                return(false);

Label_010F:
                return(true);
            }