blob: 69698916d54661ed60d0fa2be42b98a499dafc0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System;
using System.Collections.Generic;
using System.Text;
namespace IvyBus
{
[AttributeUsage(AttributeTargets.Method,AllowMultiple = true)]
public class IvyBindingAttribute : Attribute
{
string expression;
string[] args;
// translate part of expression to object property
public string GetExpression(object obj)
{
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, params string[] args)
{
this.expression = expression;
this.args = args;
}
}
}
|