本文整理汇总了C#中System.Reflection.Emit.Label.GetLabelValue方法的典型用法代码示例。如果您正苦于以下问题:C# Label.GetLabelValue方法的具体用法?C# Label.GetLabelValue怎么用?C# Label.GetLabelValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Emit.Label
的用法示例。
在下文中一共展示了Label.GetLabelValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLabelPos
private int GetLabelPos(Label lbl)
{
// Gets the position in the stream of a particular label.
// Verifies that the label exists and that it has been given a value.
int index = lbl.GetLabelValue();
if (index < 0 || index >= m_labelCount)
throw new ArgumentException(Environment.GetResourceString("Argument_BadLabel"));
if (m_labelList[index] < 0)
throw new ArgumentException(Environment.GetResourceString("Argument_BadLabelContent"));
return m_labelList[index];
}
示例2: Emit
public virtual void Emit(OpCode opcode, Label label)
{
// Puts opcode onto the stream and leaves space to include label
// when fixups are done. Labels are created using ILGenerator.DefineLabel and
// their location within the stream is fixed by using ILGenerator.MarkLabel.
// If a single-byte instruction (designated by the _S suffix in OpCodes.cs) is used,
// the label can represent a jump of at most 127 bytes along the stream.
//
// opcode must represent a branch instruction (although we don't explicitly
// verify this). Since branches are relative instructions, label will be replaced with the
// correct offset to branch during the fixup process.
int tempVal = label.GetLabelValue();
EnsureCapacity(7);
InternalEmit(opcode);
if (OpCodes.TakesSingleByteArgument(opcode)) {
AddFixup(label, m_length, 1);
m_length++;
} else {
AddFixup(label, m_length, 4);
m_length+=4;
}
}
示例3: MarkLabel
public virtual void MarkLabel(Label loc)
{
int labelValue = loc.GetLabelValue();
if ((labelValue < 0) || (labelValue >= this.m_labelList.Length))
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidLabel"));
}
if (this.m_labelList[labelValue] != -1)
{
throw new ArgumentException(Environment.GetResourceString("Argument_RedefinedLabel"));
}
this.m_labelList[labelValue] = this.m_length;
}
示例4: MarkLabel
public virtual void MarkLabel(Label loc)
{
// Defines a label by setting the position where that label is found within the stream.
// Does not allow a label to be defined more than once.
int labelIndex = loc.GetLabelValue();
//This should never happen.
if (labelIndex<0 || labelIndex>=m_labelList.Length) {
throw new ArgumentException (Environment.GetResourceString("Argument_InvalidLabel"));
}
if (m_labelList[labelIndex]!=-1) {
throw new ArgumentException (Environment.GetResourceString("Argument_RedefinedLabel"));
}
m_labelList[labelIndex]=m_length;
}
示例5: GetLabelPos
private int GetLabelPos(Label lbl)
{
int labelValue = lbl.GetLabelValue();
if ((labelValue < 0) || (labelValue >= this.m_labelCount))
{
throw new ArgumentException(Environment.GetResourceString("Argument_BadLabel"));
}
if (this.m_labelList[labelValue] < 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_BadLabelContent"));
}
return this.m_labelList[labelValue];
}
示例6: Emit
public virtual void Emit(OpCode opcode, Label label)
{
label.GetLabelValue();
this.EnsureCapacity(7);
this.InternalEmit(opcode);
if (OpCodes.TakesSingleByteArgument(opcode))
{
this.AddFixup(label, this.m_length, 1);
this.m_length++;
}
else
{
this.AddFixup(label, this.m_length, 4);
this.m_length += 4;
}
}
示例7: Emit
// Puts opcode onto the stream and leaves space to include label
// when fixups are done. Labels are created using ILGenerator.DefineLabel and
// their location within the stream is fixed by using ILGenerator.MarkLabel.
// If a single-byte instruction (designated by the _S suffix in OpCodes.cs) is used,
// the label can represent a jump of at most 127 bytes along the stream.
//
// opcode must represent a branch instruction (although we don't explicitly
// verify this). Since branches are relative instructions, label will be replaced with the
// correct offset to branch during the fixup process.
//
/// <include file='doc\ILGenerator.uex' path='docs/doc[@for="ILGenerator.Emit12"]/*' />
public virtual void Emit(OpCode opcode, Label label) {
int tempVal = label.GetLabelValue();
EnsureCapacity(7);
internalEmit(opcode);
if (OpCodes.TakesSingleByteArgument(opcode)) {
AddFixup(label, m_length, 1);
m_length++;
} else {
AddFixup(label, m_length, 4);
m_length+=4;
}
}
示例8: GetLabelPos
// Gets the position in the stream of a particular label.
// Verifies that the label exists and that it has been given a value.
//
internal virtual int GetLabelPos (Label lbl) {
int index = lbl.GetLabelValue();
if (index<0 || index>=m_labelCount) {
throw new ArgumentException(Environment.GetResourceString("Argument_BadLabel"));
}
if (m_labelList[index]<0) {
throw new ArgumentException(Environment.GetResourceString("Argument_BadLabelContent"));
}
return m_labelList[index];
}
示例9: MarkLabel
// Defines a label by setting the position where that label is found within the stream.
// Does not allow a label to be defined more than once.
//
/// <include file='doc\ILGenerator.uex' path='docs/doc[@for="ILGenerator.MarkLabel"]/*' />
public virtual void MarkLabel(Label loc) {
int labelIndex = loc.GetLabelValue();
//This should never happen.
if (labelIndex<0 || labelIndex>=m_labelList.Length) {
throw new ArgumentException (Environment.GetResourceString("Argument_InvalidLabel"));
}
if (m_labelList[labelIndex]!=-1) {
throw new ArgumentException (Environment.GetResourceString("Argument_RedefinedLabel"));
}
m_labelList[labelIndex]=m_length;
}