File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,24 @@ internal static MethodBuilder GetObjectDataMethodBuilder(TypeBuilder typeBuilder
137
137
internal static MethodBuilder GenerateMethodSignature ( string name , MethodInfo method , TypeBuilder typeBuilder )
138
138
{
139
139
//TODO: Should we use attributes of base method?
140
- var methodAttributes = MethodAttributes . Public | MethodAttributes . HideBySig | MethodAttributes . Virtual ;
140
+ MethodAttributes methodAttributes ;
141
+ if ( method . DeclaringType . IsInterface )
142
+ {
143
+ // These are the attributes used for an explicit interface method implementation in .NET.
144
+ methodAttributes =
145
+ MethodAttributes . Private |
146
+ MethodAttributes . Final |
147
+ MethodAttributes . Virtual |
148
+ MethodAttributes . HideBySig |
149
+ MethodAttributes . NewSlot |
150
+ MethodAttributes . SpecialName ;
151
+ // .NET uses an expanded name for explicit interface implementation methods.
152
+ name = typeBuilder . FullName + "." + method . DeclaringType . FullName + "." + name ;
153
+ }
154
+ else
155
+ {
156
+ methodAttributes = MethodAttributes . Public | MethodAttributes . HideBySig | MethodAttributes . Virtual ;
157
+ }
141
158
142
159
if ( method . IsSpecialName )
143
160
methodAttributes |= MethodAttributes . SpecialName ;
You can’t perform that action at this time.
0 commit comments