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

GetBaseOrParameterOrElementType() public méthode

public GetBaseOrParameterOrElementType ( ) : CType
Résultat CType
        public CType GetBaseOrParameterOrElementType()
        {
            switch (GetTypeKind())
            {
                case TypeKind.TK_ArrayType:
                    return AsArrayType().GetElementType();

                case TypeKind.TK_PointerType:
                    return AsPointerType().GetReferentType();

                case TypeKind.TK_ParameterModifierType:
                    return AsParameterModifierType().GetParameterType();

                case TypeKind.TK_NullableType:
                    return AsNullableType().GetUnderlyingType();

                default:
                    return null;
            }
        }

Usage Example

Exemple #1
0
        ////////////////////////////////////////////////////////////////////////////////
        // Strips off ArrayType, ParameterModifierType, PointerType, PinnedType and optionally NullableType
        // and returns the result.
        public CType GetNakedType(bool fStripNub)
        {
            for (CType type = this; ;)
            {
                switch (type.GetTypeKind())
                {
                default:
                    return(type);

                case TypeKind.TK_NullableType:
                    if (!fStripNub)
                    {
                        return(type);
                    }
                    type = type.GetBaseOrParameterOrElementType();
                    break;

                case TypeKind.TK_ArrayType:
                case TypeKind.TK_ParameterModifierType:
                case TypeKind.TK_PointerType:
                    type = type.GetBaseOrParameterOrElementType();
                    break;
                }
            }
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.CType::GetBaseOrParameterOrElementType