Fix bugs in sizing TableLayoutPanel (Xamarin bug 18638)
[mono.git] / mcs / class / System.Web.Mvc2 / System.Web.Mvc / ModelValidatorProviderCollection.cs
1 /* ****************************************************************************\r
2  *\r
3  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4  *\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
8  *\r
9  * You must not remove this notice, or any other, from this software.\r
10  *\r
11  * ***************************************************************************/\r
12 \r
13 namespace System.Web.Mvc {\r
14     using System;\r
15     using System.Collections.Generic;\r
16     using System.Collections.ObjectModel;\r
17     using System.Linq;\r
18 \r
19     public class ModelValidatorProviderCollection : Collection<ModelValidatorProvider> {\r
20 \r
21         public ModelValidatorProviderCollection() {\r
22         }\r
23 \r
24         public ModelValidatorProviderCollection(IList<ModelValidatorProvider> list)\r
25             : base(list) {\r
26         }\r
27 \r
28         protected override void InsertItem(int index, ModelValidatorProvider item) {\r
29             if (item == null) {\r
30                 throw new ArgumentNullException("item");\r
31             }\r
32             base.InsertItem(index, item);\r
33         }\r
34 \r
35         protected override void SetItem(int index, ModelValidatorProvider item) {\r
36             if (item == null) {\r
37                 throw new ArgumentNullException("item");\r
38             }\r
39             base.SetItem(index, item);\r
40         }\r
41 \r
42         public IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context) {\r
43             return this.SelectMany(provider => provider.GetValidators(metadata, context));\r
44         }\r
45 \r
46     }\r
47 }\r