Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.Framework / Resources / ResourceFacade.cs
blobba08a50011f5e56b9d7f34ff6522703eb8eb2de6
1 // Copyright 2004-2008 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.MonoRail.Framework.Resources
17 using System.Collections;
18 using System.Globalization;
19 using System.Resources;
21 /// <summary>
22 /// Simple facade that provides the IResource interface to a
23 /// ResourceManager instance.
24 /// </summary>
25 public class ResourceFacade : IResource
27 private readonly ResourceManager resourceManager;
28 private readonly CultureInfo cultureInfo;
30 /// <summary>
31 /// Initializes a new instance of the <see cref="ResourceFacade"/> class.
32 /// </summary>
33 /// <param name="resourceManager">The resource manager.</param>
34 /// <param name="cultureInfo">The culture info.</param>
35 public ResourceFacade(ResourceManager resourceManager, CultureInfo cultureInfo)
37 this.resourceManager = resourceManager;
38 this.cultureInfo = cultureInfo;
41 /// <summary>
42 /// Returns the object linked to the specific key.
43 /// </summary>
44 /// <param name="key"></param>
45 /// <returns></returns>
46 public object GetObject(string key)
48 return resourceManager.GetObject(key, cultureInfo);
51 /// <summary>
52 /// Returns the object linked to the specific key as a string.
53 /// </summary>
54 /// <param name="key"></param>
55 /// <returns></returns>
56 public string GetString(string key)
58 return resourceManager.GetString(key, cultureInfo);
61 /// <summary>
62 /// Returns the object linked to the specific key.
63 /// </summary>
64 /// <value></value>
65 public object this[string key]
67 get { return resourceManager.GetObject(key, cultureInfo); }
70 /// <summary>
71 /// Returns an enumerator that iterates through a collection.
72 /// </summary>
73 /// <returns>
74 /// An <see cref="T:System.Collections.IEnumerator"></see> object that can be used to iterate through the collection.
75 /// </returns>
76 public IEnumerator GetEnumerator()
78 return resourceManager
79 .GetResourceSet(cultureInfo, true, true)
80 .GetEnumerator();