Microsoft.CSharp.RuntimeBinder.Semantics.CType.getPredefType C# (CSharp) Méthode

getPredefType() public méthode

public getPredefType ( ) : PredefinedType
Résultat PredefinedType
        public PredefinedType getPredefType()
        {
            //ASSERT(isPredefined());
            return getAggregate().GetPredefType();
        }

Usage Example

            private AggCastResult bindExplicitConversionToEnum(AggregateType aggTypeDest)
            {
                Debug.Assert(_typeSrc != null);
                Debug.Assert(aggTypeDest != null);

                AggregateSymbol aggDest = aggTypeDest.getAggregate();

                if (!aggDest.IsEnum())
                {
                    return(AggCastResult.Failure);
                }

                if (_typeSrc.isPredefType(PredefinedType.PT_DECIMAL))
                {
                    return(bindExplicitConversionFromDecimalToEnum(aggTypeDest));
                }

                if (_typeSrc.isNumericType() || (_typeSrc.isPredefined() && _typeSrc.getPredefType() == PredefinedType.PT_CHAR))
                {
                    // Transform constant to constant.
                    if (_exprSrc.GetConst() != null)
                    {
                        ConstCastResult result = _binder.bindConstantCast(_exprSrc, _exprTypeDest, _needsExprDest, out _exprDest, true);
                        if (result == ConstCastResult.Success)
                        {
                            return(AggCastResult.Success);
                        }
                        if (result == ConstCastResult.CheckFailure)
                        {
                            return(AggCastResult.Abort);
                        }
                    }
                    if (_needsExprDest)
                    {
                        _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest);
                    }
                    return(AggCastResult.Success);
                }
                else if (_typeSrc.isPredefined() &&
                         (_typeSrc.isPredefType(PredefinedType.PT_OBJECT) || _typeSrc.isPredefType(PredefinedType.PT_VALUE) || _typeSrc.isPredefType(PredefinedType.PT_ENUM)))
                {
                    if (_needsExprDest)
                    {
                        _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_UNBOX);
                    }
                    return(AggCastResult.Success);
                }
                return(AggCastResult.Failure);
            }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.CType::getPredefType