本文整理汇总了C#中MethodDef.isVirtual方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDef.isVirtual方法的具体用法?C# MethodDef.isVirtual怎么用?C# MethodDef.isVirtual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MethodDef
的用法示例。
在下文中一共展示了MethodDef.isVirtual方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: renameMethod
void renameMethod(MethodDef methodDef)
{
if (methodDef.isVirtual())
throw new ApplicationException("Can't rename virtual methods here");
if (!canRenameMethod(methodDef))
return;
var info = method(methodDef);
if (info.renamed)
return;
info.renamed = true;
var checker = NameChecker;
if (!NameChecker.isValidMethodName(info.oldName)) {
INameCreator nameCreator = null;
string newName = info.suggestedName;
if (methodDef.MethodDefinition.PInvokeInfo != null)
newName = getPinvokeName(methodDef);
else if (methodDef.isStatic())
nameCreator = variableNameState.staticMethodNameCreator;
else
nameCreator = variableNameState.instanceMethodNameCreator;
if (newName != null)
nameCreator = new NameCreator2(newName);
renameMethod(methodDef, variableNameState.getNewMethodName(info.oldName, nameCreator));
}
}
示例2: renameSpecialMethod
void renameSpecialMethod(MethodDef methodDef, string newName)
{
if (methodDef == null)
return;
if (methodDef.isVirtual())
return;
renameMethod(methodDef, newName);
}
示例3: canRenameMethod
bool canRenameMethod(MethodDef methodDef)
{
var methodInfo = method(methodDef);
if (methodDef.isStatic()) {
if (methodInfo.oldName == ".cctor")
return false;
}
else if (methodDef.isVirtual()) {
if (DotNetUtils.derivesFromDelegate(type.TypeDefinition)) {
switch (methodInfo.oldName) {
case "BeginInvoke":
case "EndInvoke":
case "Invoke":
return false;
}
}
}
else {
if (methodInfo.oldName == ".ctor")
return false;
}
return true;
}