1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Collections.Generic;
\r
16 using System.Collections.ObjectModel;
\r
19 public class ValueProviderCollection : Collection<IValueProvider>, IValueProvider {
\r
21 public ValueProviderCollection() {
\r
24 public ValueProviderCollection(IList<IValueProvider> list)
\r
28 public virtual bool ContainsPrefix(string prefix) {
\r
29 return this.Any(vp => vp.ContainsPrefix(prefix));
\r
32 public virtual ValueProviderResult GetValue(string key) {
\r
33 return (from provider in this
\r
34 let result = provider.GetValue(key)
\r
35 where result != null
\r
36 select result).FirstOrDefault();
\r
39 protected override void InsertItem(int index, IValueProvider item) {
\r
41 throw new ArgumentNullException("item");
\r
43 base.InsertItem(index, item);
\r
46 protected override void SetItem(int index, IValueProvider item) {
\r
48 throw new ArgumentNullException("item");
\r
50 base.SetItem(index, item);
\r