コード例 #1
0
        /// <summary>
        /// Parses the header string to get a new instance of the <see cref="IfMatchHeader"/> class
        /// </summary>
        /// <param name="s">The header values to parse</param>
        /// <param name="etagComparer">The entity tag comparer used for the <see cref="IsMatch"/> function</param>
        /// <returns>The new instance of the <see cref="IfMatchHeader"/> class</returns>
        public static IfMatchHeader Parse(IEnumerable <string> s, EntityTagComparer etagComparer)
        {
            var result = new List <EntityTag>();

            foreach (var etag in s)
            {
                if (etag == "*")
                {
                    return(new IfMatchHeader());
                }

                result.AddRange(EntityTag.Parse(etag));
            }

            if (result.Count == 0)
            {
                return(new IfMatchHeader());
            }

            return(new IfMatchHeader(result, etagComparer));
        }