本文整理匯總了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));
});
}