summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CSharp/Ivy/Ivy/IvyBindingAttribute.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/CSharp/Ivy/Ivy/IvyBindingAttribute.cs b/CSharp/Ivy/Ivy/IvyBindingAttribute.cs
index a992192..6969891 100644
--- a/CSharp/Ivy/Ivy/IvyBindingAttribute.cs
+++ b/CSharp/Ivy/Ivy/IvyBindingAttribute.cs
@@ -8,15 +8,23 @@ namespace IvyBus
public class IvyBindingAttribute : Attribute
{
string expression;
+ string[] args;
- public string Expression
+ // translate part of expression to object property
+ public string GetExpression(object obj)
{
- get { return expression; }
+ string[] values = new string[args.Length];
+ for (int i = 0; i < args.Length; i++)
+ {
+ values[i] = (string)obj.GetType().GetProperty(args[i]).GetValue(obj,null);
+ }
+ return string.Format(expression,values);
}
- public IvyBindingAttribute(string expression)
+ public IvyBindingAttribute(string expression, params string[] args)
{
this.expression = expression;
+ this.args = args;
}
}
}