本文整理汇总了C#中System.Reflection.ConstructorInfo.GetMethodImplementationFlags方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructorInfo.GetMethodImplementationFlags方法的具体用法?C# ConstructorInfo.GetMethodImplementationFlags怎么用?C# ConstructorInfo.GetMethodImplementationFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.ConstructorInfo
的用法示例。
在下文中一共展示了ConstructorInfo.GetMethodImplementationFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GrabConstructor
protected ConstructorInfo GrabConstructor(ConstructorInfo Original, TypeBuilder On)
{
if(Original == null) return null;
if(ConstructorsDone.ContainsKey(Original))
return ConstructorsDone[Original];
if(!Sources.Contains(Original.Module))
return ConstructorReplaceGenerics(Original);
if(On == null)
On = GrabType(Original.DeclaringType) as TypeBuilder;
ConstructorBuilder Builder = On.DefineConstructor(Original.Attributes,
Original.CallingConvention, ParameterTypes(Original));
Builder.SetImplementationFlags(Original.GetMethodImplementationFlags());
if(ConstructorsDone.ContainsKey(Original))
return ConstructorsDone[Original];
ConstructorsDone.Add(Original, Builder);
CopyMethodBody(Original, Builder);
return Builder;
}
示例2: AppendConstructorInfo
static private void AppendConstructorInfo(ConstructorInfo constructor, StringBuilder sb)
{
sb.Append(".method");
foreach (var attribute in constructor.GetCustomAttributesData())
{
sb.Append(" ");
AppendCustomAttributeData(attribute, sb);
}
sb.Append(" ");
AppendMethodAttributes(sb, constructor.Attributes);
sb.Append(" ");
sb.Append("void ");
sb.Append(constructor.Name);
if (constructor.IsGenericMethod)
{
sb.Append("<");
foreach (var typeParameter in constructor.GetGenericArguments())
{
AppendType(typeParameter, sb, true);
AppendComma(sb);
}
RemoveTrailingComma(sb);
sb.Append(">");
}
sb.Append("(");
foreach (var parameter in constructor.GetParameters())
{
AppendParameterInfo(parameter, sb);
AppendComma(sb);
}
RemoveTrailingComma(sb);
sb.Append(")");
var implFlags = constructor.GetMethodImplementationFlags();
if (implFlags.HasFlag(MethodImplAttributes.IL)) sb.Append(" cil");
if (implFlags.HasFlag(MethodImplAttributes.ForwardRef)) sb.Append(" forwardref");
if (implFlags.HasFlag(MethodImplAttributes.InternalCall)) sb.Append(" internalcall");
if (implFlags.HasFlag(MethodImplAttributes.Managed)) sb.Append(" managed");
if (implFlags.HasFlag(MethodImplAttributes.Native)) sb.Append(" native");
if (implFlags.HasFlag(MethodImplAttributes.NoInlining)) sb.Append(" noinlining");
if (implFlags.HasFlag(MethodImplAttributes.NoOptimization)) sb.Append(" nooptimization");
if (implFlags.HasFlag(MethodImplAttributes.OPTIL)) sb.Append(" optil");
if (implFlags.HasFlag(MethodImplAttributes.PreserveSig)) sb.Append(" preservesig");
if (implFlags.HasFlag(MethodImplAttributes.Runtime)) sb.Append(" runtime");
if (implFlags.HasFlag(MethodImplAttributes.Synchronized)) sb.Append(" synchronized");
if (implFlags.HasFlag(MethodImplAttributes.Unmanaged)) sb.Append(" unmanaged");
}