当前位置: 首页>>代码示例>>C#>>正文


C# AggregateType.isPredefType方法代码示例

本文整理汇总了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;
            }
开发者ID:noahfalk,项目名称:corefx,代码行数:52,代码来源:ExplicitConversion.cs

示例2: GetNubFromNullable

 public NullableType GetNubFromNullable(AggregateType ats)
 {
     Debug.Assert(ats.isPredefType(PredefinedType.PT_G_OPTIONAL));
     return GetNullable(ats.GetTypeArgsAll().Item(0));
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:5,代码来源:TypeManager.cs


注:本文中的Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType.isPredefType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。