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

constValKind() public méthode

public constValKind ( ) : ConstValKind
Résultat ConstValKind
        public ConstValKind constValKind()
        {
            if (isPointerLike())
            {
                return ConstValKind.IntPtr;
            }

            switch (fundType())
            {
                case FUNDTYPE.FT_I8:
                case FUNDTYPE.FT_U8:
                    return ConstValKind.Long;
                case FUNDTYPE.FT_STRUCT:
                    // Here we can either have a decimal type, or an enum 
                    // whose fundamental type is decimal.
                    Debug.Assert((getAggregate().IsEnum() && getAggregate().GetUnderlyingType().getPredefType() == PredefinedType.PT_DECIMAL)
                        || (isPredefined() && getPredefType() == PredefinedType.PT_DATETIME)
                        || (isPredefined() && getPredefType() == PredefinedType.PT_DECIMAL));

                    if (isPredefined() && getPredefType() == PredefinedType.PT_DATETIME)
                    {
                        return ConstValKind.Long;
                    }
                    return ConstValKind.Decimal;

                case FUNDTYPE.FT_REF:
                    if (isPredefined() && getPredefType() == PredefinedType.PT_STRING)
                    {
                        return ConstValKind.String;
                    }
                    else
                    {
                        return ConstValKind.IntPtr;
                    }
                case FUNDTYPE.FT_R4:
                    return ConstValKind.Float;
                case FUNDTYPE.FT_R8:
                    return ConstValKind.Double;
                case FUNDTYPE.FT_I1:
                    return ConstValKind.Boolean;
                default:
                    return ConstValKind.Int;
            }
        }
        public CType underlyingType()

Usage Example

        public void SetDefaultParameterValue(int index, CType type, CONSTVAL cv)
        {
            Debug.Assert(_defaultParameterIndex != null);
            ConstValFactory factory = new ConstValFactory();

            _defaultParameterIndex[index]         = true;
            _defaultParameters[index]             = factory.Copy(type.constValKind(), cv);
            _defaultParameterConstValTypes[index] = type;
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.CType::constValKind