本文整理汇总了C#中Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType.isPredefType方法的典型用法代码示例。如果您正苦于以下问题:C# AggregateType.isPredefType方法的具体用法?C# AggregateType.isPredefType怎么用?C# AggregateType.isPredefType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType
的用法示例。
在下文中一共展示了AggregateType.isPredefType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bindExplicitConversionFromEnumToDecimal
private AggCastResult bindExplicitConversionFromEnumToDecimal(AggregateType aggTypeDest)
{
Debug.Assert(_typeSrc != null);
Debug.Assert(aggTypeDest != null);
Debug.Assert(aggTypeDest.isPredefType(PredefinedType.PT_DECIMAL));
AggregateType underlyingType = _typeSrc.underlyingType().AsAggregateType();
// Need to first cast the source expr to its underlying type.
EXPR exprCast;
if (_exprSrc == null)
{
exprCast = null;
}
else
{
EXPRCLASS underlyingExpr = GetExprFactory().MakeClass(underlyingType);
_binder.bindSimpleCast(_exprSrc, underlyingExpr, out exprCast);
}
// There is always an implicit conversion from any integral type to decimal.
if (exprCast.GetConst() != null)
{
// Fold the constant cast if possible.
ConstCastResult result = _binder.bindConstantCast(exprCast, _exprTypeDest, _needsExprDest, out _exprDest, true);
if (result == ConstCastResult.Success)
{
return AggCastResult.Success; // else, don't fold and use a regular cast, below.
}
if (result == ConstCastResult.CheckFailure && 0 == (_flags & CONVERTTYPE.CHECKOVERFLOW))
{
return AggCastResult.Abort;
}
}
// Conversions from integral types to decimal are always bound as a user-defined conversion.
if (_needsExprDest)
{
// According the language, this is a standard conversion, but it is implemented
// through a user-defined conversion. Because it's a standard conversion, we don't
// test the CONVERTTYPE.NOUDC flag here.
bool ok = _binder.bindUserDefinedConversion(exprCast, underlyingType, aggTypeDest, _needsExprDest, out _exprDest, false);
Debug.Assert(ok);
}
return AggCastResult.Success;
}
示例2: GetNubFromNullable
public NullableType GetNubFromNullable(AggregateType ats)
{
Debug.Assert(ats.isPredefType(PredefinedType.PT_G_OPTIONAL));
return GetNullable(ats.GetTypeArgsAll().Item(0));
}