Added container accessor to Castle.Core
[castle.git] / Core / Castle.Core / Model / DependencyModelCollection.cs
bloba8ffa3a153ae4c1a6ec775fec4a76dd7b19f771a
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;
20 /// <summary>
21 /// Collection of <see cref="DependencyModel"/>.
22 /// </summary>
23 [Serializable]
24 public class DependencyModelCollection : ReadOnlyCollectionBase
26 /// <summary>
27 /// Initializes a new instance of the <see cref="DependencyModelCollection"/> class.
28 /// </summary>
29 public DependencyModelCollection()
33 /// <summary>
34 /// Initializes a new instance of the <see cref="DependencyModelCollection"/> class.
35 /// </summary>
36 /// <param name="dependencies">The dependencies.</param>
37 public DependencyModelCollection(DependencyModelCollection dependencies)
39 InnerList.AddRange(dependencies);
42 /// <summary>
43 /// Initializes a new instance of the <see cref="DependencyModelCollection"/> class.
44 /// </summary>
45 /// <param name="dependencies">The dependencies.</param>
46 public DependencyModelCollection(DependencyModel[] dependencies)
48 InnerList.AddRange(dependencies);
51 /// <summary>
52 /// Adds the specified model.
53 /// </summary>
54 /// <param name="model">The model.</param>
55 public void Add(DependencyModel model)
57 InnerList.Add(model);
60 /// <summary>
61 /// Removes the specified model.
62 /// </summary>
63 /// <param name="model">The model.</param>
64 public void Remove(DependencyModel model)
66 InnerList.Remove(model);
69 /// <summary>
70 /// Clears this instance.
71 /// </summary>
72 public void Clear()
74 InnerList.Clear();
77 /// <summary>
78 /// Determines whether this collection contains the the specified model.
79 /// </summary>
80 /// <param name="model">The model.</param>
81 /// <returns>
82 /// <c>true</c> if the collection contains the specified model; otherwise, <c>false</c>.
83 /// </returns>
84 public bool Contains(DependencyModel model)
86 return InnerList.Contains(model);