Added container accessor to Castle.Core
[castle.git] / Core / Castle.Core / Model / PropertySetCollection.cs
blob5602e48e1a14968c7388f2dda2cce59d45adacd4
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Core
17 using System;
18 using System.Collections;
19 using System.Reflection;
21 /// <summary>
22 /// Collection of <see cref="PropertySet"/>
23 /// </summary>
24 [Serializable]
25 public class PropertySetCollection : ReadOnlyCollectionBase
27 /// <summary>
28 /// Adds the specified property.
29 /// </summary>
30 /// <param name="property">The property.</param>
31 public void Add(PropertySet property)
33 InnerList.Add(property);
36 /// <summary>
37 /// Clears this instance.
38 /// </summary>
39 public void Clear()
41 InnerList.Clear();
44 /// <summary>
45 /// Finds a PropertySet the by PropertyInfo.
46 /// </summary>
47 /// <param name="info">The info.</param>
48 /// <returns></returns>
49 public PropertySet FindByPropertyInfo(PropertyInfo info)
51 foreach(PropertySet prop in InnerList)
53 if (info == prop.Property)
55 return prop;
59 return null;