本文整理汇总了C#中MetadataToken.ToInt32方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataToken.ToInt32方法的具体用法?C# MetadataToken.ToInt32怎么用?C# MetadataToken.ToInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataToken
的用法示例。
在下文中一共展示了MetadataToken.ToInt32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public void Write(MethodBody body, /*Telerik Authorship*/ MetadataToken methodToken, /*Telerik Authorship*/ MetadataToken localVarToken)
{
/*Telerik Authorship*/
//var method_token = body.Method.MetadataToken;
var sym_token = new SymbolToken (methodToken.ToInt32 ());
//var sym_token = new SymbolToken(body.Method.MetadataToken.ToInt32());
var instructions = CollectInstructions (body);
if (instructions.Count == 0)
return;
var start_offset = 0;
var end_offset = body.CodeSize;
writer.OpenMethod (sym_token);
writer.OpenScope (start_offset);
DefineSequencePoints (instructions);
/*Telerik Authorship*/
Dictionary<VariableDefinition, string> methodVariableDefinitionToNameMap =
GetMethodVariableDefinitionToNameMap(body.Method);
DefineVariables(body, /*Telerik Authorship*/ localVarToken, /*Telerik Authorship*/ methodVariableDefinitionToNameMap, start_offset, end_offset);
writer.CloseScope (end_offset);
writer.CloseMethod ();
}
示例2: DefineVariables
void DefineVariables(MethodBody body, /*Telerik Authorship*/ MetadataToken localVarToken, /*Telerik Authorship*/ Dictionary<VariableDefinition, string> methodVariableDefinitionToNameMap, int start_offset, int end_offset)
{
if (!body.HasVariables)
return;
/*Telerik Authorship*/
//var sym_token = new SymbolToken (body.LocalVarToken.ToInt32 ());
var sym_token = new SymbolToken(localVarToken.ToInt32());
var variables = body.Variables;
for (int i = 0; i < variables.Count; i++) {
var variable = variables [i];
/*Telerik Authorship*/
string variableName = GetVariableName(variable, methodVariableDefinitionToNameMap);
CreateLocalVariable(variable, /*Telerik Authorship*/ variableName, sym_token, start_offset, end_offset);
}
}