System.Reflection.Emit.ILGenerator.EmitLoadArgument(int)

Here are the examples of the csharp api System.Reflection.Emit.ILGenerator.EmitLoadArgument(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : ILGeneratorExtensions.cs
with MIT License
from Sergio0694

public static void EmitLoadArgumentForMemberRead(this ILGenerator il, int index, MemberInfo member)
        {
            switch (member)
            {
                case FieldInfo _:
                    il.EmitLoadArgument(index);
                    break;
                case PropertyInfo _:
                    if (member.DeclaringType.IsValueType) il.EmitLoadArgumentAddress(index);
                    else il.EmitLoadArgument(index);
                    break;
                default: throw new ArgumentException($"The input {member.GetType()} instance can't be read");
            }
        }

19 Source : ILGeneratorExtensions.cs
with MIT License
from Sergio0694

public static void EmitLoadArgument<T>(this ILGenerator il, T index) where T : Enum => il.EmitLoadArgument((int)(object)index);