本文整理汇总了C#中IMetaDataImport.GetParamProps方法的典型用法代码示例。如果您正苦于以下问题:C# IMetaDataImport.GetParamProps方法的具体用法?C# IMetaDataImport.GetParamProps怎么用?C# IMetaDataImport.GetParamProps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMetaDataImport
的用法示例。
在下文中一共展示了IMetaDataImport.GetParamProps方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParamOwnerRid
public unsafe static uint GetParamOwnerRid(IMetaDataImport mdi, uint token) {
if (mdi == null)
return 0;
uint ownerToken;
int hr = mdi.GetParamProps(token, new IntPtr(&ownerToken), IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
if (hr != 0)
return 0;
var ownerMdToken = new MDToken(ownerToken);
return ownerMdToken.Table == Table.Method ? ownerMdToken.Rid : 0;
}
示例2: GetParamConstant
public unsafe static object GetParamConstant(IMetaDataImport mdi, uint token, out CorElementType constantType) {
constantType = CorElementType.End;
if (mdi == null)
return null;
uint cchValue;
IntPtr pValue;
CorElementType constantTypeTmp;
int hr = mdi.GetParamProps(token, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, new IntPtr(&constantTypeTmp), new IntPtr(&pValue), new IntPtr(&cchValue));
if (hr < 0 || pValue == IntPtr.Zero)
return null;
constantType = constantTypeTmp;
return ReadConstant(pValue, cchValue, constantType);
}
示例3: GetParamSeqAndAttrs
public unsafe static bool GetParamSeqAndAttrs(IMetaDataImport mdi, uint token, out uint seq, out ParamAttributes attrs) {
seq = uint.MaxValue;
attrs = 0;
if (mdi == null)
return false;
uint ulSequence, dwAttr;
int hr = mdi.GetParamProps(token, IntPtr.Zero, new IntPtr(&ulSequence), IntPtr.Zero, 0, IntPtr.Zero, new IntPtr(&dwAttr), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
if (hr != 0)
return false;
seq = ulSequence;
attrs = (ParamAttributes)dwAttr;
return true;
}
示例4: GetParamName
public unsafe static string GetParamName(IMetaDataImport mdi, uint token) {
if (mdi == null)
return null;
char[] nameBuf = null;
uint chName;
int hr = mdi.GetParamProps(token, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, new IntPtr(&chName), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
if (hr >= 0 && chName != 0) {
nameBuf = new char[chName];
fixed (char* p = &nameBuf[0])
hr = mdi.GetParamProps(token, IntPtr.Zero, IntPtr.Zero, new IntPtr(p), (uint)nameBuf.Length, new IntPtr(&chName), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
}
if (hr < 0)
return null;
return chName <= 1 ? string.Empty : new string(nameBuf, 0, (int)chName - 1);
}
示例5: _PrintArgs
static void _PrintArgs(ICorDebugILFrame ilframe, IMetaDataImport importer, System.IO.TextWriter writer)
{
uint argcount;
{
ICorDebugValueEnum ven;
ilframe.EnumerateArguments(out ven);
ven.GetCount(out argcount);
}
if (argcount < 1)
{
return;
}
uint ftoken;
ilframe.GetFunctionToken(out ftoken);
System.Reflection.MethodAttributes fattribs;
{
uint chMethod;
uint dwAttr;
IntPtr pvSigBlob;
uint cbSigBlob;
uint ulCodeRVA;
uint dwImplFlags;
uint ftypedeftoken;
int hrmethodprops = (int)importer.GetMethodProps(ftoken, out ftypedeftoken,
null, 0, out chMethod,
out dwAttr,
out pvSigBlob, out cbSigBlob,
out ulCodeRVA, out dwImplFlags);
Marshal.ThrowExceptionForHR(hrmethodprops);
char[] methodnamechars = new char[chMethod];
hrmethodprops = (int)importer.GetMethodProps(ftoken, out ftypedeftoken,
methodnamechars, (uint)methodnamechars.Length, out chMethod,
out dwAttr,
out pvSigBlob, out cbSigBlob,
out ulCodeRVA, out dwImplFlags);
Marshal.ThrowExceptionForHR(hrmethodprops);
chMethod--; // Remove nul.
//MethodName = new string(methodnamechars, 0, (int)chMethod);
fattribs = (System.Reflection.MethodAttributes)dwAttr;
}
List<uint> paramtoks = new List<uint>();
{
uint henum = 0;
try
{
uint[] aoneparamtok = new uint[1];
for (; ; )
{
uint count;
importer.EnumParams(ref henum, ftoken, aoneparamtok, 1, out count);
if (1 != count)
{
break;
}
paramtoks.Add(aoneparamtok[0]);
}
}
finally
{
importer.CloseEnum(henum);
}
}
uint ia = 0;
int ip = 0; //paramtoks.Count - (int)argcount;
for (; ia < argcount; ia++)
{
string argname;
if (0 == ia
&& System.Reflection.MethodAttributes.Static != (fattribs & System.Reflection.MethodAttributes.Static))
{
argname = "this";
}
else
{
if (ip >= paramtoks.Count)
{
argname = "unnamed_param_" + (1 + ia).ToString();
}
else
{
{
uint ptok = paramtoks[ip++];
uint parenttok;
uint pulSequence;
uint argnamelen = 0;
uint dwAttr, dwCPlusTypeFlag, cchValue;
IntPtr pValue;
importer.GetParamProps(ptok, out parenttok, out pulSequence, null, argnamelen, out argnamelen,
out dwAttr, out dwCPlusTypeFlag, out pValue, out cchValue);
char[] argnamebuf = new char[argnamelen];
importer.GetParamProps(ptok, out parenttok, out pulSequence, argnamebuf, argnamelen, out argnamelen,
out dwAttr, out dwCPlusTypeFlag, out pValue, out cchValue);
argnamelen--; // Remove nul.
argname = new string(argnamebuf, 0, (int)argnamelen);
}
}
//.........这里部分代码省略.........
示例6: GetParameterInfo
unsafe static MDParamInfo? GetParameterInfo(IMetaDataImport mdi, uint token) {
if (mdi == null)
return null;
char[] nameBuf = null;
uint ulSequence,chName,dwAttr;
int hr = mdi.GetParamProps(token, IntPtr.Zero, out ulSequence, IntPtr.Zero, 0, out chName, out dwAttr, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
if (hr >= 0 && chName != 0) {
nameBuf = new char[chName];
fixed (char* p = &nameBuf[0])
hr = mdi.GetParamProps(token, IntPtr.Zero, out ulSequence, new IntPtr(p), (uint)nameBuf.Length, out chName, out dwAttr, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
}
if (hr < 0)
return null;
var name = chName <= 1 ? string.Empty : new string(nameBuf, 0, (int)chName - 1);
return new MDParamInfo(name, token, ulSequence, dwAttr);
}