summaryrefslogtreecommitdiff
path: root/IvyPPC/IvyBindingAttribute.cs
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:05:47 +0000
committerfcolin2007-02-01 12:05:47 +0000
commit3593a483d5566779f1d56e037615685cdc77c0a0 (patch)
tree300986bb2f463148fd0773efc5f69654ae2cd53f /IvyPPC/IvyBindingAttribute.cs
parent3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6 (diff)
downloadivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.zip
ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.gz
ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.bz2
ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.xz
modification structure svn
Diffstat (limited to 'IvyPPC/IvyBindingAttribute.cs')
-rw-r--r--IvyPPC/IvyBindingAttribute.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/IvyPPC/IvyBindingAttribute.cs b/IvyPPC/IvyBindingAttribute.cs
new file mode 100644
index 0000000..90c44ce
--- /dev/null
+++ b/IvyPPC/IvyBindingAttribute.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace IvyBus
+{
+ [AttributeUsage(AttributeTargets.Method,AllowMultiple = true)]
+ public sealed class IvyBindingAttribute : Attribute
+ {
+ private string expression;
+ private string[] args;
+
+ // translate part of expression to object property
+ public string GetExpression(object obj)
+ {
+ if (obj == null) return string.Format(expression);
+ object[] values = new object[args.Length];
+ for (int i = 0; i < args.Length; i++)
+ {
+ values[i] = obj.GetType().GetProperty(args[i]).GetValue(obj,null);
+ }
+ return string.Format(expression,values);
+ }
+
+ public IvyBindingAttribute(string expression, params string[] args)
+ {
+ this.expression = expression;
+ this.args = args;
+ }
+ }
+}