本文整理汇总了C#中MethodImplAttributes类的典型用法代码示例。如果您正苦于以下问题:C# MethodImplAttributes类的具体用法?C# MethodImplAttributes怎么用?C# MethodImplAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodImplAttributes类属于命名空间,在下文中一共展示了MethodImplAttributes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:methodimplattribute.cs
示例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);
}
开发者ID:ESgarbi,项目名称:corefx,代码行数:8,代码来源:MethodBuilderSetImplementationFlags.cs
示例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();
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:9,代码来源:CommonMethodWellKnownAttributeData.cs
示例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;
}
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:17,代码来源:MethodDefRow.cs
示例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;
}
开发者ID:hj1980,项目名称:Mosa,代码行数:19,代码来源:MethodDefRow.cs
示例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;
}
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:19,代码来源:MethodDefRow.cs
示例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>();
}
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:22,代码来源:CilRuntimeMethod.cs
示例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);
}
开发者ID:sidecut,项目名称:xaeios,代码行数:12,代码来源:MethodDefinition.cs
示例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);
}
}
开发者ID:Astaelan,项目名称:Fusion,代码行数:16,代码来源:MethodDefData.cs
示例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();
}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:38,代码来源:MethodImplAttributes.cs
示例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;
}
开发者ID:dmirmilshteyn,项目名称:dnlib,代码行数:28,代码来源:ModuleDefMD.cs
示例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;
}
开发者ID:leftouterjoin,项目名称:loj-prj1,代码行数:11,代码来源:MetadataRowWriter.cs
示例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;
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:28,代码来源:MetadataSignatureHelper.cs
示例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);
}
开发者ID:tzetang,项目名称:corefx,代码行数:20,代码来源:MetadataBuilder.Tables.cs
示例15: SetImplementationFlags
public void SetImplementationFlags (MethodImplAttributes attributes)
{
if (type.is_created)
throw not_after_created ();
iattrs = attributes;
}
开发者ID:jack-pappas,项目名称:mono,代码行数:7,代码来源:ConstructorBuilder.cs
示例16: SetCustomAttribute
public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
{
if (customBuilder == null)
throw new ArgumentNullException ("customBuilder");
switch (customBuilder.Ctor.ReflectedType.FullName) {
case "System.Runtime.CompilerServices.MethodImplAttribute":
byte[] data = customBuilder.Data;
int impla; // the (stupid) ctor takes a short or an int ...
impla = (int)data [2];
impla |= ((int)data [3]) << 8;
iattrs |= (MethodImplAttributes)impla;
return;
case "System.Runtime.InteropServices.DllImportAttribute":
CustomAttributeBuilder.CustomAttributeInfo attr = CustomAttributeBuilder.decode_cattr (customBuilder);
bool preserveSig = true;
/*
* It would be easier to construct a DllImportAttribute from
* the custom attribute builder, but the DllImportAttribute
* does not contain all the information required here, ie.
* - some parameters, like BestFitMapping has three values
* ("on", "off", "missing"), but DllImportAttribute only
* contains two (on/off).
* - PreserveSig is true by default, while it is false by
* default in DllImportAttribute.
*/
pi_dll = (string)attr.ctorArgs[0];
if (pi_dll == null || pi_dll.Length == 0)
throw new ArgumentException ("DllName cannot be empty");
native_cc = System.Runtime.InteropServices.CallingConvention.Winapi;
for (int i = 0; i < attr.namedParamNames.Length; ++i) {
string name = attr.namedParamNames [i];
object value = attr.namedParamValues [i];
if (name == "CallingConvention")
native_cc = (CallingConvention)value;
else if (name == "CharSet")
charset = (CharSet)value;
else if (name == "EntryPoint")
pi_entry = (string)value;
else if (name == "ExactSpelling")
ExactSpelling = (bool)value;
else if (name == "SetLastError")
SetLastError = (bool)value;
else if (name == "PreserveSig")
preserveSig = (bool)value;
else if (name == "BestFitMapping")
BestFitMapping = (bool)value;
else if (name == "ThrowOnUnmappableChar")
ThrowOnUnmappableChar = (bool)value;
}
attrs |= MethodAttributes.PinvokeImpl;
if (preserveSig)
iattrs |= MethodImplAttributes.PreserveSig;
return;
case "System.Runtime.InteropServices.PreserveSigAttribute":
iattrs |= MethodImplAttributes.PreserveSig;
return;
case "System.Runtime.CompilerServices.SpecialNameAttribute":
attrs |= MethodAttributes.SpecialName;
return;
case "System.Security.SuppressUnmanagedCodeSecurityAttribute":
attrs |= MethodAttributes.HasSecurity;
break;
}
if (cattrs != null) {
CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
cattrs.CopyTo (new_array, 0);
new_array [cattrs.Length] = customBuilder;
cattrs = new_array;
} else {
cattrs = new CustomAttributeBuilder [1];
cattrs [0] = customBuilder;
}
}
开发者ID:stabbylambda,项目名称:mono,代码行数:83,代码来源:MethodBuilder.cs
示例17: SetImplementationFlags
public void SetImplementationFlags (MethodImplAttributes attributes)
{
RejectIfCreated ();
iattrs = attributes;
}
开发者ID:stabbylambda,项目名称:mono,代码行数:5,代码来源:MethodBuilder.cs
示例18: Read
} // Read
public static uint Read(this NativeReader reader, uint offset, out MethodImplAttributes value)
{
uint ivalue;
offset = reader.DecodeUnsigned(offset, out ivalue);
value = (MethodImplAttributes)ivalue;
return offset;
} // Read
开发者ID:huamichaelchen,项目名称:corert,代码行数:9,代码来源:MdBinaryReaderGen.cs
示例19: SetMethodImpl
internal static extern void SetMethodImpl(RuntimeModule module, int tkMethod, MethodImplAttributes MethodImplAttributes);
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:typebuilder.cs
示例20: GetMethodAttributes
public static unsafe bool GetMethodAttributes(IMetaDataImport mdi, uint token, out MethodAttributes dwAttr, out MethodImplAttributes dwImplFlags) {
dwAttr = 0;
dwImplFlags = 0;
if (mdi == null)
return false;
uint dwAttr2, dwImplFlags2;
int hr = mdi.GetMethodProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, new IntPtr(&dwAttr2), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, new IntPtr(&dwImplFlags2));
if (hr < 0)
return false;
dwAttr = (MethodAttributes)dwAttr2;
dwImplFlags = (MethodImplAttributes)dwImplFlags2;
return true;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:MDAPI.cs
注:本文中的MethodImplAttributes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论