private void CreateAddMethod() { Assertion.IsNull(_addMethod); MethodAttributes flags = MethodAttributes.Public | MethodAttributes.SpecialName; if (EventKind == EventKind.Static) { flags |= MethodAttributes.Static; } IMethodEmitter method = _declaringType.CreateMethod("add_" + Name, flags, typeof(void), new [] { EventType }); AddMethod = method; }
// TODO FS: Test for explicit interface implementation public IMethodEmitter CreateGetMethod() { if (GetMethod != null) { throw new InvalidOperationException("This property already has a getter method."); } else { MethodAttributes flags = MethodAttributes.Public | MethodAttributes.SpecialName; if (PropertyKind == PropertyKind.Static) { flags |= MethodAttributes.Static; } IMethodEmitter method = _declaringType.CreateMethod(BuildAccessorMethodName(Name, "get"), flags, PropertyType, IndexParameters); GetMethod = method; return(method); } }