-
Notifications
You must be signed in to change notification settings - Fork 78
/
BindableMember.cs
57 lines (51 loc) · 1.61 KB
/
BindableMember.cs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Reflection;
namespace UnityWeld.Binding.Internal
{
/// <summary>
/// Data structure combining a bindable property or method with the view model it belongs
/// to. This is needed because we can't always rely on MemberInfo.ReflectedType
/// returning the type of the view model if the property or method was declared in an
/// interface that the view model inherits from.
/// </summary>
public class BindableMember<TMemberType> where TMemberType : MemberInfo
{
/// <summary>
/// The bindable member info (usually a PropertyInfo or MethodInfo)
/// </summary>
public readonly TMemberType Member;
/// <summary>
/// View model that the property or method belongs to.
/// </summary>
public readonly Type ViewModelType;
/// <summary>
/// Name of the view model type.
/// </summary>
public string ViewModelTypeName
{
get
{
return ViewModelType.Name;
}
}
/// <summary>
/// Name of the member.
/// </summary>
public string MemberName
{
get
{
return Member.Name;
}
}
public BindableMember(TMemberType member, Type viewModelType)
{
Member = member;
ViewModelType = viewModelType;
}
public override string ToString()
{
return string.Concat(ViewModelType.ToString(), ".", MemberName);
}
}
}