#pragma warning restore CS0618 // Type or member is obsolete

        /// <summary>
        /// Renders the dependencies marked for inclusion.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        public MvcHtmlString RenderIncludes(WebDependencyPosition position)
        {
            var sb = new StringBuilder();

            sb.AppendLine("<!-- WebDependencies/" + position + " - start -->");

            if (this.includes != null && this.includes.Count > 0)
            {
                var sorted = this.includes.Values.OrderBy(i => i.Item1.Order).ToArray();
                for (int i = 0; i < sorted.Length; i++)
                {
                    var item         = sorted[i].Item1;
                    var itemPosition = sorted[i].Item2;
#pragma warning disable CS0618 // Type or member is obsolete
                    if (itemPosition == position || itemPosition == WebDependencyPosition.Default && item.DefaultPosition == position)
                    {
                        if (item.Files != null)
                        {
                            for (int j = 0; j < item.Files.Count; j++)
                            {
                                RenderDependency(item.Files[j], sb);
                            }
                        }
                    }
#pragma warning restore CS0618 // Type or member is obsolete
                }
            }

            sb.AppendLine("<!-- WebDependencies/" + position + " - end -->");
            return(MvcHtmlString.Create(sb.ToString()));
        }
        /// <summary>
        /// Mark the specified dependency for inclusion.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="position">The position.</param>
        /// <returns></returns>
#pragma warning disable CS0618 // Type or member is obsolete
        public WebDependencies Include(WebDependency value, WebDependencyPosition position = WebDependencyPosition.Default)
        {
            if (this.includes == null)
            {
                this.includes = new Dictionary <string, Tuple <WebDependency, WebDependencyPosition> >();
            }

            Tuple <WebDependency, WebDependencyPosition> includeCandidate;

            if (!this.includes.TryGetValue(value.Name, out includeCandidate))
            {
                // not included yet
                this.includes.Add(value.Name, new Tuple <WebDependency, WebDependencyPosition>(value, position));
            }
            else
            {
                // already included. Take the highest position
                var replace = false;
                if (position != WebDependencyPosition.Default)
                {
                    if (includeCandidate.Item2 == WebDependencyPosition.Default)
                    {
                        replace = true;
                    }
                    else if (position < includeCandidate.Item2)
                    {
                        replace = true;
                    }
                    else
                    {
                        // do not replace
                    }
                }
                else
                {
                    // position is default, do not replace
                }

                if (replace)
                {
                    this.includes[value.Name] = new Tuple <WebDependency, WebDependencyPosition>(value, position);
                }
            }

            return(this);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDependency" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="defaultPosition">The default position.</param>
 /// <param name="order">The order of rendering.</param>
 public WebDependency(string name, WebDependencyPosition defaultPosition, int order)
 {
     this.Name            = name;
     this.defaultPosition = defaultPosition;
     this.Order           = order;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDependency"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="defaultPosition">The default position.</param>
 public WebDependency(string name, WebDependencyPosition defaultPosition)
 {
     this.Name            = name;
     this.defaultPosition = defaultPosition;
 }