本文整理汇总了C#中TypeMap.SubstituteCustomModifiers方法的典型用法代码示例。如果您正苦于以下问题:C# TypeMap.SubstituteCustomModifiers方法的具体用法?C# TypeMap.SubstituteCustomModifiers怎么用?C# TypeMap.SubstituteCustomModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeMap
的用法示例。
在下文中一共展示了TypeMap.SubstituteCustomModifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReturnTypesMatch
private static bool ReturnTypesMatch(MethodSymbol candidateMethod, TypeMap candidateMethodTypeMap, ref ParamInfo<TypeSymbol> targetReturnParam)
{
Debug.Assert(candidateMethodTypeMap != null);
if (candidateMethod.ReturnsByRef != targetReturnParam.IsByRef)
{
return false;
}
TypeSymbol candidateReturnType = candidateMethod.ReturnType;
TypeSymbol targetReturnType = targetReturnParam.Type;
// CONSIDER: Do we want to add special handling for error types? Right now, we expect they'll just fail to match.
var substituted = new TypeWithModifiers(candidateReturnType, candidateMethod.ReturnTypeCustomModifiers).SubstituteType(candidateMethodTypeMap);
if (substituted.Type != targetReturnType)
{
return false;
}
if (!CustomModifiersMatch(substituted.CustomModifiers, targetReturnParam.CustomModifiers) ||
!CustomModifiersMatch(candidateMethodTypeMap.SubstituteCustomModifiers(candidateMethod.RefCustomModifiers), targetReturnParam.RefCustomModifiers))
{
return false;
}
return true;
}
示例2: ParametersMatch
private static bool ParametersMatch(ParameterSymbol candidateParam, TypeMap candidateMethodTypeMap, ref ParamInfo<TypeSymbol> targetParam)
{
Debug.Assert(candidateMethodTypeMap != null);
// This could be combined into a single return statement with a more complicated expression, but that would
// be harder to debug.
if ((candidateParam.RefKind != RefKind.None) != targetParam.IsByRef)
{
return false;
}
// CONSIDER: Do we want to add special handling for error types? Right now, we expect they'll just fail to match.
var substituted = new TypeWithModifiers(candidateParam.Type, candidateParam.CustomModifiers).SubstituteType(candidateMethodTypeMap);
if (substituted.Type != targetParam.Type)
{
return false;
}
if (!CustomModifiersMatch(substituted.CustomModifiers, targetParam.CustomModifiers) ||
!CustomModifiersMatch(candidateMethodTypeMap.SubstituteCustomModifiers(candidateParam.RefCustomModifiers), targetParam.RefCustomModifiers))
{
return false;
}
return true;
}