Microsoft.CSharp.RuntimeBinder.Semantics.TypeArray.ItemAsTypeParameterType C# (CSharp) Method

ItemAsTypeParameterType() public method

public ItemAsTypeParameterType ( int i ) : Microsoft.CSharp.RuntimeBinder.Semantics.TypeParameterType
i int
return Microsoft.CSharp.RuntimeBinder.Semantics.TypeParameterType
        public TypeParameterType ItemAsTypeParameterType(int i) { return _items[i].AsTypeParameterType(); }

Usage Example

        public TypeArray typeVars;          // All the type variables for a generic method, as declarations.

        // If there is a type variable in the method which is used in no parameter,
        // then inference must fail. Since this is expensive to check, we cache
        // the result of the first call.

        public bool InferenceMustFail()
        {
            if (checkedInfMustFail)
            {
                return(inferenceMustFail);
            }
            Debug.Assert(!inferenceMustFail);
            checkedInfMustFail = true;
            for (int ivar = 0; ivar < typeVars.Size; ivar++)
            {
                TypeParameterType var = typeVars.ItemAsTypeParameterType(ivar);
                // See if type var is used in a parameter.
                for (int ipar = 0; ; ipar++)
                {
                    if (ipar >= Params.Size)
                    {
                        // This type variable is not in any parameter.
                        inferenceMustFail = true;
                        return(true);
                    }
                    if (TypeManager.TypeContainsType(Params.Item(ipar), var))
                    {
                        break;
                    }
                }
            }
            // All type variables are used in a parameter.
            return(false);
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.TypeArray::ItemAsTypeParameterType