本文整理汇总了C#中System.Reflection.MethodBase.IsSealed方法的典型用法代码示例。如果您正苦于以下问题:C# MethodBase.IsSealed方法的具体用法?C# MethodBase.IsSealed怎么用?C# MethodBase.IsSealed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.MethodBase
的用法示例。
在下文中一共展示了MethodBase.IsSealed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToModel
private CodeDocMethod ConvertToModel(MethodBase methodBase, CodeDocMemberDetailLevel detailLevel, ICodeDocMemberDataProvider extraMemberDataProvider = null)
{
Contract.Requires(methodBase != null);
Contract.Ensures(Contract.Result<CodeDocMethod>() != null);
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocMethod>().ShortName));
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocMethod>().FullName));
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocMethod>().Title));
Contract.Ensures(Contract.Result<CodeDocMethod>().Title == Contract.Result<CodeDocMethod>().ShortName);
Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<CodeDocMethod>().SubTitle));
var includeExceptions = detailLevel != CodeDocMemberDetailLevel.Minimum;
var appendXmlDoc = detailLevel.HasFlag(CodeDocMemberDetailLevel.Summary) || detailLevel.HasFlag(CodeDocMemberDetailLevel.AdditionalContents);
var provideXmlDoc = includeExceptions || detailLevel != CodeDocMemberDetailLevel.Minimum;
var includeInheritance = detailLevel.HasFlag(CodeDocMemberDetailLevel.Inheritance);
var includeParameters = detailLevel != CodeDocMemberDetailLevel.Minimum;
var methodInfo = methodBase as MethodInfo;
var methodCRef = GetCRefIdentifier(methodBase);
var model = new CodeDocMethod(methodCRef);
model.Uri = GetUri(methodBase);
var memberDataProvider = new CodeDocMemberInfoProvider<MethodBase>(methodBase);
if (provideXmlDoc) {
var xmlDocs = XmlDocs.GetMember(methodCRef.FullCRef);
if (xmlDocs != null)
memberDataProvider.Add(new CodeDocMemberXmlDataProvider(xmlDocs));
}
if (extraMemberDataProvider != null)
memberDataProvider.Add(extraMemberDataProvider);
if (includeInheritance && methodInfo != null) {
var baseDefinition = methodInfo.FindNextAncestor();
if (baseDefinition != null) {
var baseDefinitionModel = GetOnly(GetCRefIdentifier(baseDefinition), detailLevel);
if (baseDefinitionModel != null)
memberDataProvider.Add(new CodeDocMemberDataProvider(baseDefinitionModel));
}
}
if (appendXmlDoc)
ApplyContentXmlDocs(model, memberDataProvider);
model.ExternalVisibility = memberDataProvider.ExternalVisibility ?? ExternalVisibilityKind.Public;
model.ShortName = RegularTypeDisplayNameOverlay.GetDisplayName(methodBase);
model.FullName = FullTypeDisplayNameOverlay.GetDisplayName(methodBase);
model.Title = model.ShortName;
Contract.Assume(methodBase.DeclaringType != null);
model.NamespaceName = methodBase.DeclaringType.Namespace;
if (includeParameters) {
model.Parameters = Array.ConvertAll(
methodBase.GetParameters(),
p => CreateArgument(p, memberDataProvider));
if (methodInfo != null && methodInfo.ReturnParameter != null &&
methodInfo.ReturnType != typeof (void))
model.Return = CreateReturn(methodInfo.ReturnParameter, memberDataProvider);
}
if (methodBase.IsConstructor)
model.SubTitle = "Constructor";
else if (model.Parameters != null && model.Parameters.Count == 1 && model.HasReturn && CSharpOperatorNameSymbolMap.IsConversionOperatorMethodName(methodBase.Name)) {
model.SubTitle = "Conversion";
string conversionOperationName;
if (methodBase.Name.EndsWith("Explicit", StringComparison.OrdinalIgnoreCase))
conversionOperationName = "Explicit";
else if (methodBase.Name.EndsWith("Implicit", StringComparison.OrdinalIgnoreCase))
conversionOperationName = "Implicit";
else
conversionOperationName = String.Empty;
var conversionParameterPart = String.Concat(
model.Parameters[0].ParameterType.ShortName,
" to ",
model.Return.ParameterType.ShortName);
model.ShortName = String.IsNullOrEmpty(conversionOperationName)
? conversionParameterPart
: String.Concat(conversionOperationName, ' ', conversionParameterPart);
model.Title = model.ShortName;
}
else if (methodBase.IsOperatorOverload())
model.SubTitle = "Operator";
else
model.SubTitle = "Method";
Contract.Assume(methodBase.DeclaringType != null);
model.Namespace = GetOrCreateNamespaceByName(methodBase.DeclaringType.Namespace);
model.Assembly = GetCodeDocAssembly(methodBase.DeclaringType.Assembly);
model.DeclaringType = GetOrConvert(methodBase.DeclaringType, CodeDocMemberDetailLevel.Minimum);
model.IsOperatorOverload = methodBase.IsOperatorOverload();
model.IsExtensionMethod = methodBase.IsExtensionMethod();
model.IsSealed = methodBase.IsSealed();
model.IsStatic = memberDataProvider.IsStatic.GetValueOrDefault();
model.IsObsolete = memberDataProvider.IsObsolete.GetValueOrDefault();
model.IsPure = memberDataProvider.IsPure.GetValueOrDefault();
//.........这里部分代码省略.........