本文整理汇总了C#中MetadataReader.GetParameter方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataReader.GetParameter方法的具体用法?C# MetadataReader.GetParameter怎么用?C# MetadataReader.GetParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataReader
的用法示例。
在下文中一共展示了MetadataReader.GetParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateParam
/// <summary>
/// Param Table Columns:
/// Name (offset to #String)
/// Flags, Sequence (2 byte unsigned)
/// </summary>
private void ValidateParam(MetadataReader reader, uint startIndex, uint count, bool isMod = false)
{
if (count == 0)
{
return;
}
// AppCS - 7
var expNames = new string[] { "p", "t", "p", "value", "t", "value", "t" };
// =================
// ModuleVB01 - 20
var modNames = new string[]
{
"index", "index", "value", "em", "cls", "del", "obj", "obj", "o", "e",
"p", "TargetObject", "TargetMethod", "o", "e",
"DelegateCallback", "DelegateAsyncState", "DelegateAsyncResult", "o", "e",
};
var modFlags = new ushort[] { 0, 0, 0, 0, 0x1010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
var modSeqs = new ushort[] { 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 3, 4, 1, 1, 2, };
if (startIndex > reader.ParamTable.NumberOfRows)
{
return;
}
uint zeroBased = startIndex - 1;
uint delta = count;
// Last one
if (0xF0000000 == count)
{
delta = (uint)reader.ParamTable.NumberOfRows - zeroBased;
if (0 == delta)
{
return;
}
}
Assert.InRange((uint)reader.ParamTable.NumberOfRows, zeroBased + delta, uint.MaxValue); // 1 based
for (uint i = zeroBased; i < zeroBased + delta; i++)
{
var handle = ParameterHandle.FromRowId((int)i + 1);
var row = reader.GetParameter(handle);
// Console.WriteLine("P: {0}", GetStringData(row.Name));
if (isMod)
{
Assert.Equal(modNames[i], reader.GetString(row.Name));
Assert.Equal(modFlags[i], (ushort)row.Attributes);
Assert.Equal(modSeqs[i], row.SequenceNumber);
}
else
{
Assert.Equal(expNames[i], reader.GetString(row.Name));
Assert.Equal((ushort)0, (ushort)row.Attributes);
Assert.Equal((ushort)1, row.SequenceNumber);
}
} // for
}