本文整理汇总了C#中Mono.Cecil.TypeDefinition.GetLdArgForType方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition.GetLdArgForType方法的具体用法?C# TypeDefinition.GetLdArgForType怎么用?C# TypeDefinition.GetLdArgForType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeDefinition
的用法示例。
在下文中一共展示了TypeDefinition.GetLdArgForType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNormalCheck
static void AddNormalCheck(TypeDefinition type, Collection<Instruction> c, PropertyDefinition property, ParameterDefinition left, ParameterDefinition right)
{
var genericInstance = new Lazy<TypeReference>(() => property.PropertyType.GetGenericInstanceType(type));
var getMethodImported = ReferenceFinder.ImportCustom(property.GetGetMethod(type));
c.Add(Instruction.Create(type.GetLdArgForType(), left));
c.Add(Instruction.Create(getMethodImported.GetCallForMethod(), getMethodImported));
if (property.PropertyType.IsValueType || property.PropertyType.IsGenericParameter)
{
c.Add(Instruction.Create(OpCodes.Box, genericInstance.Value));
}
c.Add(Instruction.Create(type.GetLdArgForType(), right));
c.Add(Instruction.Create(getMethodImported.GetCallForMethod(), getMethodImported));
if (property.PropertyType.IsValueType || property.PropertyType.IsGenericParameter)
{
c.Add(Instruction.Create(OpCodes.Box, genericInstance.Value));
}
c.Add(Instruction.Create(OpCodes.Call, ReferenceFinder.Object.StaticEquals));
}
示例2: AddSimpleValueCheck
static void AddSimpleValueCheck(Collection<Instruction> c, PropertyDefinition property, TypeDefinition type, ParameterDefinition left, ParameterDefinition right)
{
var getMethod = property.GetGetMethod(type);
var getMethodImported = ReferenceFinder.ImportCustom(getMethod);
c.Add(Instruction.Create(type.GetLdArgForType(), left));
c.Add(Instruction.Create(getMethodImported.GetCallForMethod(), getMethodImported));
c.Add(Instruction.Create(type.GetLdArgForType(), right));
c.Add(Instruction.Create(getMethodImported.GetCallForMethod(), getMethodImported));
c.Add(Instruction.Create(OpCodes.Ceq));
}
示例3: AddCollectionEquals
static void AddCollectionEquals(TypeDefinition type, MethodDefinition collectionEquals, PropertyDefinition property, TypeDefinition propType, Collection<Instruction> e, ParameterDefinition left, ParameterDefinition right)
{
e.If(
cf =>
{
cf.Add(Instruction.Create(type.GetLdArgForType(), right));
cf.Add(Instruction.Create(OpCodes.Ldnull));
cf.Add(Instruction.Create(OpCodes.Ceq));
},
t => t.Add(Instruction.Create(OpCodes.Ldc_I4_0)),
es =>
{
var getMethod = property.GetGetMethod(type);
var getMethodImported = ReferenceFinder.ImportCustom(getMethod);
es.Add(Instruction.Create(type.GetLdArgForType(), left));
es.Add(Instruction.Create(getMethodImported.GetCallForMethod(), getMethodImported));
if (propType.IsValueType)
{
es.Add(Instruction.Create(OpCodes.Box, propType));
}
es.Add(Instruction.Create(type.GetLdArgForType(), right));
es.Add(Instruction.Create(getMethodImported.GetCallForMethod(), getMethodImported));
if (propType.IsValueType)
{
es.Add(Instruction.Create(OpCodes.Box, propType));
}
es.Add(Instruction.Create(OpCodes.Call, collectionEquals));
});
}