Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ EmitCastToType()

static void System.Linq.Expressions.Compiler.ILGen.EmitCastToType ( this ILGenerator il,
Type typeFrom,
Type typeTo )
inlinestaticprivate

Definition at line 478 of file ILGen.cs.

479 {
480 if (typeFrom.IsValueType)
481 {
482 il.Emit(OpCodes.Box, typeFrom);
483 if (typeTo != typeof(object))
484 {
485 il.Emit(OpCodes.Castclass, typeTo);
486 }
487 }
488 else
489 {
490 il.Emit(typeTo.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, typeTo);
491 }
492 }
static readonly OpCode Castclass
Definition OpCodes.cs:235
static readonly OpCode Unbox_Any
Definition OpCodes.cs:329
static readonly OpCode Box
Definition OpCodes.cs:279

References System.Reflection.Emit.OpCodes.Box, System.Reflection.Emit.OpCodes.Castclass, System.Reflection.Emit.ILGenerator.Emit(), System.Type.IsValueType, and System.Reflection.Emit.OpCodes.Unbox_Any.