in ILRepack/RepackImporter.cs [294:322]
private void CloneTo(EventDefinition evt, TypeDefinition nt, Collection<EventDefinition> col)
{
// ignore duplicate event
if (nt.Events.Any(x => x.Name == evt.Name))
{
_logger.DuplicateIgnored("event", evt);
return;
}
EventDefinition ed = new EventDefinition(evt.Name, evt.Attributes, Import(evt.EventType, nt));
col.Add(ed);
if (evt.AddMethod != null)
ed.AddMethod = FindMethodInNewType(nt, evt.AddMethod);
if (evt.RemoveMethod != null)
ed.RemoveMethod = FindMethodInNewType(nt, evt.RemoveMethod);
if (evt.InvokeMethod != null)
ed.InvokeMethod = FindMethodInNewType(nt, evt.InvokeMethod);
if (evt.HasOtherMethods)
{
foreach (MethodDefinition meth in evt.OtherMethods)
{
var nm = FindMethodInNewType(nt, meth);
if (nm != null)
ed.OtherMethods.Add(nm);
}
}
CopyCustomAttributes(evt.CustomAttributes, ed.CustomAttributes, nt);
}