Fixing an issue with output parameters that are of type IntPtr
[castle.git] / InversionOfControl / Castle.MicroKernel / Registration / Parameter.cs
blob74060a41666ee56f65bac34718905e3c5d457b75
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.MicroKernel.Registration
17 using System;
18 using Castle.Core.Configuration;
20 /// <summary>
21 /// Represents a configuration parameter.
22 /// </summary>
23 public class Parameter
25 private readonly String key;
26 private readonly String value;
27 private readonly IConfiguration configNode;
29 internal Parameter(String key, String value)
31 this.key = key;
32 this.value = value;
35 internal Parameter(String key, IConfiguration configNode)
37 this.key = key;
38 this.configNode = configNode;
41 /// <summary>
42 /// Gets the parameter key.
43 /// </summary>
44 public string Key
46 get { return key; }
49 /// <summary>
50 /// Gets the parameter value.
51 /// </summary>
52 public String Value
54 get { return value; }
57 /// <summary>
58 /// Gets the parameter configuration.
59 /// </summary>
60 public IConfiguration ConfigNode
62 get { return configNode; }
65 /// <summary>
66 /// Create a <see cref="ParameterKey"/> with key.
67 /// </summary>
68 /// <param name="key">The parameter key.</param>
69 /// <returns>The new <see cref="ParameterKey"/></returns>
70 public static ParameterKey ForKey(String key)
72 return new ParameterKey(key);
76 #region ParameterKey
78 /// <summary>
79 /// Represents a parameter key.
80 /// </summary>
81 public class ParameterKey
83 private readonly String name;
85 internal ParameterKey(String name)
87 this.name = name;
90 /// <summary>
91 /// The parameter key name.
92 /// </summary>
93 public string Name
95 get { return name; }
98 /// <summary>
99 /// Builds the <see cref="Parameter"/> with key/value.
100 /// </summary>
101 /// <param name="value">The parameter value.</param>
102 /// <returns>The new <see cref="Parameter"/></returns>
103 public Parameter Eq(String value)
105 return new Parameter(name, value);
108 /// <summary>
109 /// Builds the <see cref="Parameter"/> with key/config.
110 /// </summary>
111 /// <param name="configNode">The parameter configuration.</param>
112 /// <returns>The new <see cref="Parameter"/></returns>
113 public Parameter Eq(IConfiguration configNode)
115 return new Parameter(name, configNode);
118 #endregion