本文整理汇总了C#中Microsoft.CSharp.RuntimeBinder.Semantics.CType.StripNubs方法的典型用法代码示例。如果您正苦于以下问题:C# CType.StripNubs方法的具体用法?C# CType.StripNubs怎么用?C# CType.StripNubs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CSharp.RuntimeBinder.Semantics.CType
的用法示例。
在下文中一共展示了CType.StripNubs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: isEnumToDecimalConversion
private static bool isEnumToDecimalConversion(CType argtype, CType desttype)
{
CType strippedArgType = argtype.IsNullableType() ? argtype.StripNubs() : argtype;
CType strippedDestType = desttype.IsNullableType() ? desttype.StripNubs() : desttype;
return strippedArgType.isEnumType() && strippedDestType.isPredefType(PredefinedType.PT_DECIMAL);
}
示例2: BindLiftedUDUnop
private EXPRCALL BindLiftedUDUnop(EXPR arg, CType typeArg, MethPropWithInst mpwi)
{
CType typeRaw = typeArg.StripNubs();
if (!arg.type.IsNullableType() || !canConvert(arg.type.StripNubs(), typeRaw, CONVERTTYPE.NOUDC))
{
// Convert then lift.
arg = mustConvert(arg, typeArg);
}
Debug.Assert(arg.type.IsNullableType());
CType typeRet = GetTypes().SubstType(mpwi.Meth().RetType, mpwi.GetType());
if (!typeRet.IsNullableType())
{
typeRet = GetTypes().GetNullable(typeRet);
}
// First bind the non-lifted version for errors.
EXPR nonLiftedArg = mustCast(arg, typeRaw);
EXPRCALL nonLiftedResult = BindUDUnopCall(nonLiftedArg, typeRaw, mpwi);
EXPRMEMGRP pMemGroup = GetExprFactory().CreateMemGroup(null, mpwi);
EXPRCALL call = GetExprFactory().CreateCall(0, typeRet, arg, pMemGroup, null);
call.mwi = new MethWithInst(mpwi);
call.castOfNonLiftedResultToLiftedType = mustCast(nonLiftedResult, typeRet, 0);
call.nubLiftKind = NullableCallLiftKind.Operator;
return call;
}
示例3: IsNullableValueType
protected bool IsNullableValueType(CType pType)
{
if (pType.IsNullableType())
{
CType pStrippedType = pType.StripNubs();
return pStrippedType.IsAggregateType() && pStrippedType.AsAggregateType().getAggregate().IsValueType();
}
return false;
}
示例4: GetUserDefinedBinopArgumentType
private AggregateType GetUserDefinedBinopArgumentType(CType type)
{
for (; ;)
{
switch (type.GetTypeKind())
{
case TypeKind.TK_NullableType:
type = type.StripNubs();
break;
case TypeKind.TK_TypeParameterType:
type = type.AsTypeParameterType().GetEffectiveBaseClass();
break;
case TypeKind.TK_AggregateType:
if ((type.isClassType() || type.isStructType()) && !type.AsAggregateType().getAggregate().IsSkipUDOps())
{
return type.AsAggregateType();
}
return null;
default:
return null;
}
}
}