本文整理汇总了C#中System.Reflection.EventInfo.FindNextAncestor方法的典型用法代码示例。如果您正苦于以下问题:C# EventInfo.FindNextAncestor方法的具体用法?C# EventInfo.FindNextAncestor怎么用?C# EventInfo.FindNextAncestor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.EventInfo
的用法示例。
在下文中一共展示了EventInfo.FindNextAncestor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToModel
private CodeDocEvent ConvertToModel(EventInfo eventInfo, CodeDocMemberDetailLevel detailLevel, ICodeDocMemberDataProvider extraMemberDataProvider = null)
{
Contract.Requires(eventInfo != null);
Contract.Ensures(Contract.Result<CodeDocEvent>() != null);
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocEvent>().ShortName));
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocEvent>().FullName));
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocEvent>().Title));
Contract.Ensures(Contract.Result<CodeDocEvent>().Title == Contract.Result<CodeDocEvent>().ShortName);
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocEvent>().SubTitle));
var includeInheritance = detailLevel.HasFlag(CodeDocMemberDetailLevel.Inheritance);
var appendXmlDoc = detailLevel.HasFlag(CodeDocMemberDetailLevel.Summary) || detailLevel.HasFlag(CodeDocMemberDetailLevel.AdditionalContents);
var provideXmlDoc = detailLevel != CodeDocMemberDetailLevel.Minimum;
var eventCRef = GetCRefIdentifier(eventInfo);
var model = new CodeDocEvent(eventCRef);
model.Uri = GetUri(eventInfo);
var memberDataProvider = new CodeDocMemberInfoProvider<EventInfo>(eventInfo);
if (provideXmlDoc) {
var xmlDocs = XmlDocs.GetMember(eventCRef.FullCRef);
if (xmlDocs != null)
memberDataProvider.Add(new CodeDocMemberXmlDataProvider(xmlDocs));
}
if (extraMemberDataProvider != null)
memberDataProvider.Add(extraMemberDataProvider);
if (includeInheritance) {
var baseEvent = eventInfo.FindNextAncestor();
if (baseEvent != null) {
var baseEventModel = GetOnly(GetCRefIdentifier(baseEvent), detailLevel);
if (baseEventModel != null)
memberDataProvider.Add(new CodeDocMemberDataProvider(baseEventModel));
}
}
if (appendXmlDoc)
ApplyContentXmlDocs(model, memberDataProvider);
model.ExternalVisibility = memberDataProvider.ExternalVisibility ?? ExternalVisibilityKind.Public;
model.ShortName = RegularTypeDisplayNameOverlay.GetDisplayName(memberDataProvider.Member);
model.FullName = FullTypeDisplayNameOverlay.GetDisplayName(memberDataProvider.Member);
model.Title = model.ShortName;
Contract.Assume(memberDataProvider.Member.DeclaringType != null);
model.NamespaceName = memberDataProvider.Member.DeclaringType.Namespace;
model.SubTitle = "Event";
model.DelegateType = GetOrConvert(eventInfo.EventHandlerType, CodeDocMemberDetailLevel.Minimum);
Contract.Assume(eventInfo.DeclaringType != null);
model.Namespace = GetOrCreateNamespaceByName(eventInfo.DeclaringType.Namespace);
model.Assembly = GetCodeDocAssembly(eventInfo.DeclaringType.Assembly);
model.DeclaringType = GetOrConvert(eventInfo.DeclaringType, CodeDocMemberDetailLevel.Minimum);
model.IsStatic = memberDataProvider.IsStatic.GetValueOrDefault();
model.IsObsolete = memberDataProvider.IsObsolete.GetValueOrDefault();
return model;
}