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

Item() public method

public Item ( int i ) : CType
i int
return CType
        public CType Item(int i) { return _items[i]; }
        public TypeParameterType ItemAsTypeParameterType(int i) { return _items[i].AsTypeParameterType(); }

Usage Example

示例#1
0
        private static Type CalculateAssociatedSystemTypeForAggregate(AggregateType aggtype)
        {
            AggregateSymbol agg      = aggtype.GetOwningAggregate();
            TypeArray       typeArgs = aggtype.GetTypeArgsAll();

            List <Type> list = new List <Type>();

            // Get each type arg.
            for (int i = 0; i < typeArgs.size; i++)
            {
                // Unnamed type parameter types are just placeholders.
                if (typeArgs.Item(i).IsTypeParameterType() && typeArgs.Item(i).AsTypeParameterType().GetTypeParameterSymbol().name == null)
                {
                    return(null);
                }
                list.Add(typeArgs.Item(i).AssociatedSystemType);
            }

            Type[] systemTypeArgs     = list.ToArray();
            Type   uninstantiatedType = agg.AssociatedSystemType;

            if (uninstantiatedType.GetTypeInfo().IsGenericType)
            {
                try
                {
                    return(uninstantiatedType.MakeGenericType(systemTypeArgs));
                }
                catch (ArgumentException)
                {
                    // If the constraints don't work, just return the type without substituting it.
                    return(uninstantiatedType);
                }
            }
            return(uninstantiatedType);
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.TypeArray::Item