本文整理汇总了C#中MethodImplAttributes类的典型用法代码示例。如果您正苦于以下问题:C# MethodImplAttributes类的具体用法?C# MethodImplAttributes怎么用?C# MethodImplAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodImplAttributes类属于命名空间,在下文中一共展示了MethodImplAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MethodImplAttribute
internal MethodImplAttribute(MethodImplAttributes methodImplAttributes)
{
MethodImplOptions all =
MethodImplOptions.Unmanaged | MethodImplOptions.ForwardRef | MethodImplOptions.PreserveSig |
MethodImplOptions.InternalCall | MethodImplOptions.Synchronized | MethodImplOptions.NoInlining;
_val = ((MethodImplOptions)methodImplAttributes) & all;
}
示例2: SetImplementationFlags
public void SetImplementationFlags(MethodImplAttributes implementationFlags)
{
TypeBuilder type = Helpers.DynamicType(TypeAttributes.Abstract);
MethodBuilder method = type.DefineMethod("TestMethod", MethodAttributes.Public);
method.SetImplementationFlags(implementationFlags);
Assert.Equal(implementationFlags, method.MethodImplementationFlags);
}
示例3: SetMethodImplementation
// used by MethodImplAttribute
public void SetMethodImplementation(int attributeIndex, MethodImplAttributes attributes)
{
VerifySealed(expected: false);
Debug.Assert(attributeIndex >= 0);
this.attributes = attributes;
this.methodImplIndex = attributeIndex;
SetDataStored();
}
示例4: MethodDefRow
/// <summary>
/// Initializes a new instance of the <see cref="MethodDefRow"/> struct.
/// </summary>
/// <param name="rva">The rva.</param>
/// <param name="implFlags">The impl flags.</param>
/// <param name="flags">The flags.</param>
/// <param name="paramList">The param list.</param>
public MethodDefRow(uint rva, MethodImplAttributes implFlags, MethodAttributes flags, HeapIndexToken nameString,
HeapIndexToken signatureBlob, Token paramList)
{
Rva = rva;
ImplFlags = implFlags;
Flags = flags;
NameString = nameString;
SignatureBlob = signatureBlob;
ParamList = paramList;
}
示例5: MethodDefRow
/// <summary>
/// Initializes a new instance of the <see cref="MethodDefRow"/> struct.
/// </summary>
/// <param name="rva">The rva.</param>
/// <param name="implFlags">The impl flags.</param>
/// <param name="flags">The flags.</param>
/// <param name="nameStringIdx">The name string idx.</param>
/// <param name="signatureBlobIdx">The signature BLOB idx.</param>
/// <param name="paramList">The param list.</param>
public MethodDefRow(uint rva, MethodImplAttributes implFlags, MethodAttributes flags, TokenTypes nameStringIdx,
TokenTypes signatureBlobIdx, TokenTypes paramList)
{
_rva = rva;
_implFlags = implFlags;
_flags = flags;
_nameStringIdx = nameStringIdx;
_signatureBlobIdx = signatureBlobIdx;
_paramList = paramList;
}
示例6: MethodDefRow
/// <summary>
/// Initializes a new instance of the <see cref="MethodDefRow"/> struct.
/// </summary>
/// <param name="rva">The rva.</param>
/// <param name="implFlags">The impl flags.</param>
/// <param name="flags">The flags.</param>
/// <param name="nameStringIdx">The name string idx.</param>
/// <param name="signatureBlobIdx">The signature BLOB idx.</param>
/// <param name="paramList">The param list.</param>
public MethodDefRow(uint rva, MethodImplAttributes implFlags, MethodAttributes flags, HeapIndexToken nameStringIdx,
HeapIndexToken signatureBlobIdx, Token paramList)
{
this._rva = rva;
this._implFlags = implFlags;
this._flags = flags;
this._nameStringIdx = nameStringIdx;
this._signatureBlobIdx = signatureBlobIdx;
this._paramList = paramList;
}
示例7: CilRuntimeMethod
/// <summary>
/// Initializes a new instance of the <see cref="CilRuntimeMethod"/> class.
/// </summary>
/// <param name="module">The module.</param>
/// <param name="name">The name.</param>
/// <param name="signature">The signature.</param>
/// <param name="token">The token.</param>
/// <param name="declaringType">Type of the declaring.</param>
/// <param name="methodAttributes">The method attributes.</param>
/// <param name="methodImplAttributes">The method impl attributes.</param>
/// <param name="rva">The rva.</param>
public CilRuntimeMethod(ITypeModule module, string name, MethodSignature signature, Token token, RuntimeType declaringType, MethodAttributes methodAttributes, MethodImplAttributes methodImplAttributes, uint rva)
: base(module, token, declaringType)
{
base.Attributes = methodAttributes;
base.ImplAttributes = methodImplAttributes;
base.Rva = rva;
this.Name = name;
this.Signature = signature;
this.Parameters = new List<RuntimeParameter>();
}
示例8: MethodDefinition
public MethodDefinition(string name, RVA rva,
MethodAttributes attrs, MethodImplAttributes implAttrs,
bool hasThis, bool explicitThis, MethodCallingConvention callConv)
: base(name, hasThis, explicitThis, callConv)
{
m_rva = rva;
m_attributes = attrs;
m_implAttrs = implAttrs;
if (!IsStatic)
m_this = new ParameterDefinition ("this", 0, (ParameterAttributes) 0, null);
}
示例9: LoadData
private void LoadData(CLIFile pFile)
{
RVA = pFile.ReadUInt32();
ImplFlags = (MethodImplAttributes)pFile.ReadUInt16();
Flags = (MethodAttributes)pFile.ReadUInt16();
Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit));
Signature = pFile.ReadBlobHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Blob32Bit));
if (pFile.ParamTable.Length >= 0xFFFF) ParamListIndex = pFile.ReadInt32() - 1;
else ParamListIndex = pFile.ReadUInt16() - 1;
if (RVA != 0)
{
Body = new MethodDefBodyData();
Body.LoadData(this);
}
}
示例10: ToString
internal static string ToString(MethodImplAttributes flags) {
var sb = new StringBuilder();
switch ((flags & MethodImplAttributes.CodeTypeMask)) {
case MethodImplAttributes.IL: sb.Append("IL"); break;
case MethodImplAttributes.Native: sb.Append("Native"); break;
case MethodImplAttributes.OPTIL: sb.Append("OPTIL"); break;
case MethodImplAttributes.Runtime: sb.Append("Runtime"); break;
}
if ((flags & MethodImplAttributes.Unmanaged) != 0)
sb.Append(" | Unmanaged");
else
sb.Append(" | Managed");
if ((flags & MethodImplAttributes.ForwardRef) != 0)
sb.Append(" | ForwardRef");
if ((flags & MethodImplAttributes.PreserveSig) != 0)
sb.Append(" | PreserveSig");
if ((flags & MethodImplAttributes.InternalCall) != 0)
sb.Append(" | InternalCall");
if ((flags & MethodImplAttributes.Synchronized) != 0)
sb.Append(" | Synchronized");
if ((flags & MethodImplAttributes.NoInlining) != 0)
sb.Append(" | NoInlining");
if ((flags & MethodImplAttributes.AggressiveInlining) != 0)
sb.Append(" | AggressiveInlining");
if ((flags & MethodImplAttributes.NoOptimization) != 0)
sb.Append(" | NoOptimization");
return sb.ToString();
}
示例11: ReadMethodBody
/// <summary>
/// Reads a method body
/// </summary>
/// <param name="method">Method</param>
/// <param name="rva">Method RVA</param>
/// <param name="implAttrs">Method impl attrs</param>
/// <param name="gpContext">Generic parameter context</param>
/// <returns>A <see cref="MethodBody"/> or <c>null</c> if none</returns>
internal MethodBody ReadMethodBody(MethodDefMD method, RVA rva, MethodImplAttributes implAttrs, GenericParamContext gpContext)
{
MethodBody mb;
var mDec = methodDecrypter;
if (mDec != null && mDec.GetMethodBody(method.OrigRid, rva, method.Parameters, gpContext, out mb)) {
var cilBody = mb as CilBody;
if (cilBody != null)
return InitializeBodyFromPdb(cilBody, method.OrigRid);
return mb;
}
if (rva == 0)
return null;
var codeType = implAttrs & MethodImplAttributes.CodeTypeMask;
if (codeType == MethodImplAttributes.IL)
return InitializeBodyFromPdb(ReadCilBody(method.Parameters, rva, gpContext), method.OrigRid);
if (codeType == MethodImplAttributes.Native)
return new NativeMethodBody(rva);
return null;
}
示例12: CreateMethodRow
public MethodRow CreateMethodRow(RVA _rVA, MethodImplAttributes _implFlags, MethodAttributes _flags, uint _name, uint _signature, uint _paramList)
{
MethodRow row = new MethodRow ();
row.RVA = _rVA;
row.ImplFlags = _implFlags;
row.Flags = _flags;
row.Name = _name;
row.Signature = _signature;
row.ParamList = _paramList;
return row;
}
示例13: AppendMethodImplAttributes
public static StringBuilder AppendMethodImplAttributes(StringBuilder sb, MethodImplAttributes attributes)
{
string codeType;
switch (attributes & MethodImplAttributes.CodeTypeMask)
{
case MethodImplAttributes.IL: codeType = "cil"; break;
case MethodImplAttributes.OPTIL: codeType = "optil"; break;
case MethodImplAttributes.Runtime: codeType = "runtime"; break;
case MethodImplAttributes.Native: codeType = "native"; break;
default:
throw new InvalidOperationException();
}
sb.Append(codeType);
sb.Append(" ");
sb.Append((attributes & MethodImplAttributes.Unmanaged) == MethodImplAttributes.Unmanaged ? "unmanaged" : "managed");
if ((attributes & MethodImplAttributes.PreserveSig) != 0) sb.Append(" preservesig");
if ((attributes & MethodImplAttributes.ForwardRef) != 0) sb.Append(" forwardref");
if ((attributes & MethodImplAttributes.InternalCall) != 0) sb.Append(" internalcall");
if ((attributes & MethodImplAttributes.Synchronized) != 0) sb.Append(" synchronized");
if ((attributes & MethodImplAttributes.NoInlining) != 0) sb.Append(" noinlining");
if ((attributes & MethodImplAttributes.AggressiveInlining) != 0) sb.Append(" aggressiveinlining");
if ((attributes & MethodImplAttributes.NoOptimization) != 0) sb.Append(" nooptimization");
return sb;
}
示例14: AddMethodDefinition
public MethodDefinitionHandle AddMethodDefinition(
MethodAttributes attributes,
MethodImplAttributes implAttributes,
StringHandle name,
BlobHandle signature,
int bodyOffset,
ParameterHandle paramList)
{
_methodDefTable.Add(new MethodRow
{
Flags = (ushort)attributes,
ImplFlags = (ushort)implAttributes,
Name = name,
Signature = signature,
BodyOffset = bodyOffset,
ParamList = (uint)MetadataTokens.GetRowNumber(paramList)
});
return MetadataTokens.MethodDefinitionHandle(_methodDefTable.Count);
}
示例15: SetImplementationFlags
public void SetImplementationFlags (MethodImplAttributes attributes)
{
if (type.is_created)
throw not_after_created ();
iattrs = attributes;
}