本文整理汇总了C#中Mono.Cecil.TypeDefinition.GetEvent方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition.GetEvent方法的具体用法?C# TypeDefinition.GetEvent怎么用?C# TypeDefinition.GetEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeDefinition
的用法示例。
在下文中一共展示了TypeDefinition.GetEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WeaveTypeInterface
protected void WeaveTypeInterface(TypeDefinition type)
{
var destinationEvent = type.GetEvent("PropertyChanged");
type = destinationEvent.DeclaringType; //can be base type
var weaver = new TypeWeaver(originType, type);
weaver.ProcessNestedTypes();
//TODO delete event generated field
weaver.Merge(tNotifierEvent, destinationEvent);
weaver.AddDefinition(tNotifierMethod);
weaver.AddDefinition(tNotifierField);
weaver.ProcessInstructions();
}
示例2: CreateNewEvent
private EventDefinition CreateNewEvent(TypeDefinition targetType, EventDefinition yourEvent,
NewMemberAttribute newEventAttr)
{
if (newEventAttr.IsImplicit) {
Log_implicitly_creating_member("event", yourEvent);
} else {
Log_creating_member("event", yourEvent);
}
var newName = newEventAttr.NewMemberName ?? yourEvent.Name;
var maybeDuplicate = targetType.GetEvent(newName);
if (maybeDuplicate != null) {
var prevName = newName;
Log_duplicate_member("event", yourEvent, maybeDuplicate);
newName = GetNameAfterCollision(newName);
Log_name_changed("event", yourEvent, prevName, newName);
}
var targetEvent = CopyEvent(yourEvent, newName);
targetType.Events.Add(targetEvent);
return targetEvent;
}