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

isInterfaceType() public méthode

public isInterfaceType ( ) : bool
Résultat bool
        public bool isInterfaceType()
        {
            return (IsAggregateType() && getAggregate().IsInterface());
        }
        public bool isClassType()

Usage Example

            private bool bindImplicitConversionFromArray()
            {
                // 13.1.4
                //
                // The implicit reference conversions are:
                //
                // *   From an array-type S with an element type SE to an array-type T with an element
                //     type TE, provided all of the following are true:
                //     *   S and T differ only in element type. In other words, S and T have the same number of dimensions.
                //     *   An implicit reference conversion exists from SE to TE.
                // *   From a one-dimensional array-type S[] to System.Collections.Generic.IList<S>,
                //     System.Collections.Generic.IReadOnlyList<S> and their base interfaces
                // *   From a one-dimensional array-type S[] to System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyList<T>
                //     and their base interfaces, provided there is an implicit reference conversion from S to T.
                // *   From any array-type to System.Array.
                // *   From any array-type to any interface implemented by System.Array.

                if (!GetSymbolLoader().HasBaseConversion(_typeSrc, _typeDest))
                {
                    return(false);
                }

                EXPRFLAG grfex = 0;

                // The above if checks for dest==Array, object or an interface the array implements,
                // including IList<T>, ICollection<T>, IEnumerable<T>, IReadOnlyList<T>, IReadOnlyCollection<T>
                // and the non-generic versions.

                if ((_typeDest.IsArrayType() ||
                     (_typeDest.isInterfaceType() &&
                      _typeDest.AsAggregateType().GetTypeArgsAll().Size == 1 &&
                      ((_typeDest.AsAggregateType().GetTypeArgsAll().Item(0) != _typeSrc.AsArrayType().GetElementType()) ||
                       0 != (_flags & CONVERTTYPE.FORCECAST))))
                    &&
                    (0 != (_flags & CONVERTTYPE.FORCECAST) ||
                     TypeManager.TypeContainsTyVars(_typeSrc, null) ||
                     TypeManager.TypeContainsTyVars(_typeDest, null)))
                {
                    grfex = EXPRFLAG.EXF_REFCHECK;
                }
                if (_needsExprDest)
                {
                    _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, grfex);
                }
                return(true);
            }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.CType::isInterfaceType