comparison Source/TypeBuilder/Builders/FakeMethodInfo.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2 using System.Globalization;
3 using System.Reflection;
4
5 namespace BLToolkit.TypeBuilder.Builders
6 {
7 abstract class FakeMethodInfo : MethodInfo
8 {
9 protected FakeMethodInfo(PropertyInfo propertyInfo, MethodInfo pair)
10 {
11 _property = propertyInfo;
12 _pair = pair;
13 }
14
15 protected MethodInfo _pair;
16 protected PropertyInfo _property;
17
18 public override MethodAttributes Attributes
19 {
20 get { return _pair.Attributes; }
21 }
22
23 public override CallingConventions CallingConvention
24 {
25 get { return _pair.CallingConvention; }
26 }
27
28 public override Type DeclaringType
29 {
30 get { return _property.DeclaringType; }
31 }
32
33 public override MethodInfo GetBaseDefinition()
34 {
35 return _pair.GetBaseDefinition();
36 }
37
38 public override object[] GetCustomAttributes(bool inherit)
39 {
40 return _property.GetCustomAttributes(inherit);
41 }
42
43 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
44 {
45 return _property.GetCustomAttributes(attributeType, inherit);
46 }
47
48 public override MethodImplAttributes GetMethodImplementationFlags()
49 {
50 return _pair.GetMethodImplementationFlags();
51 }
52
53 public override object Invoke(
54 object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
55 {
56 return null;
57 }
58
59 public override bool IsDefined(Type attributeType, bool inherit)
60 {
61 return false;
62 }
63
64 public override MemberTypes MemberType
65 {
66 get { return _property.MemberType; }
67 }
68
69 public override RuntimeMethodHandle MethodHandle
70 {
71 get { return new RuntimeMethodHandle(); }
72 }
73
74 public override Type ReflectedType
75 {
76 get { return _property.ReflectedType; }
77 }
78
79 class CustomAttributeProvider : ICustomAttributeProvider
80 {
81 static readonly object[] _object = new object[0];
82
83 public object[] GetCustomAttributes(bool inherit)
84 {
85 return _object;
86 }
87
88 public object[] GetCustomAttributes(Type attributeType, bool inherit)
89 {
90 return _object;
91 }
92
93 public bool IsDefined(Type attributeType, bool inherit)
94 {
95 return false;
96 }
97 }
98
99 static readonly CustomAttributeProvider _customAttributeProvider = new CustomAttributeProvider();
100
101 public override ICustomAttributeProvider ReturnTypeCustomAttributes
102 {
103 get { return _customAttributeProvider; }
104 }
105
106 public override ParameterInfo ReturnParameter
107 {
108 get { return new FakeParameterInfo("ret", ReturnType, this, null); }
109 }
110 }
111 }