本文整理汇总了C#中ArrayContainer.GetSetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayContainer.GetSetMethod方法的具体用法?C# ArrayContainer.GetSetMethod怎么用?C# ArrayContainer.GetSetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayContainer
的用法示例。
在下文中一共展示了ArrayContainer.GetSetMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitArrayStore
//
// Emits the right opcode to store to an array
//
public void EmitArrayStore (ArrayContainer ac)
{
if (ac.Rank > 1) {
if (IsAnonymousStoreyMutateRequired)
ac = (ArrayContainer) ac.Mutate (CurrentAnonymousMethod.Storey.Mutator);
ig.Emit (OpCodes.Call, ac.GetSetMethod ());
return;
}
var type = ac.Element;
if (type.Kind == MemberKind.Enum)
type = EnumSpec.GetUnderlyingType (type);
switch (type.BuiltinType) {
case BuiltinTypeSpec.Type.Byte:
case BuiltinTypeSpec.Type.SByte:
case BuiltinTypeSpec.Type.Bool:
Emit (OpCodes.Stelem_I1);
return;
case BuiltinTypeSpec.Type.Short:
case BuiltinTypeSpec.Type.UShort:
case BuiltinTypeSpec.Type.Char:
Emit (OpCodes.Stelem_I2);
return;
case BuiltinTypeSpec.Type.Int:
case BuiltinTypeSpec.Type.UInt:
Emit (OpCodes.Stelem_I4);
return;
case BuiltinTypeSpec.Type.Long:
case BuiltinTypeSpec.Type.ULong:
Emit (OpCodes.Stelem_I8);
return;
case BuiltinTypeSpec.Type.Float:
Emit (OpCodes.Stelem_R4);
return;
case BuiltinTypeSpec.Type.Double:
Emit (OpCodes.Stelem_R8);
return;
}
switch (type.Kind) {
case MemberKind.Struct:
Emit (OpCodes.Stobj, type);
break;
case MemberKind.TypeParameter:
Emit (OpCodes.Stelem, type);
break;
case MemberKind.PointerType:
Emit (OpCodes.Stelem_I);
break;
default:
Emit (OpCodes.Stelem_Ref);
break;
}
}
示例2: EmitArrayStore
//
// Emits the right opcode to store to an array
//
public void EmitArrayStore (ArrayContainer ac)
{
if (ac.Rank > 1) {
if (IsAnonymousStoreyMutateRequired)
ac = (ArrayContainer) ac.Mutate (CurrentAnonymousMethod.Storey.Mutator);
ig.Emit (OpCodes.Call, ac.GetSetMethod ());
return;
}
var type = ac.Element;
if (type.IsEnum)
type = EnumSpec.GetUnderlyingType (type);
if (type == TypeManager.byte_type || type == TypeManager.sbyte_type || type == TypeManager.bool_type)
Emit (OpCodes.Stelem_I1);
else if (type == TypeManager.short_type || type == TypeManager.ushort_type || type == TypeManager.char_type)
Emit (OpCodes.Stelem_I2);
else if (type == TypeManager.int32_type || type == TypeManager.uint32_type)
Emit (OpCodes.Stelem_I4);
else if (type == TypeManager.int64_type || type == TypeManager.uint64_type)
Emit (OpCodes.Stelem_I8);
else if (type == TypeManager.float_type)
Emit (OpCodes.Stelem_R4);
else if (type == TypeManager.double_type)
Emit (OpCodes.Stelem_R8);
else if (type == TypeManager.intptr_type)
Emit (OpCodes.Stobj, type);
else if (TypeManager.IsStruct (type))
Emit (OpCodes.Stobj, type);
else if (type.IsGenericParameter)
Emit (OpCodes.Stelem, type);
else if (type.IsPointer)
Emit (OpCodes.Stelem_I);
else
Emit (OpCodes.Stelem_Ref);
}