Boo.Lang.Compiler.TypeSystem.TypeSystemServices.GetEnumeratorItemType C# (CSharp) Method

GetEnumeratorItemType() public method

public GetEnumeratorItemType ( IType iteratorType ) : IType
iteratorType IType
return IType
        public IType GetEnumeratorItemType(IType iteratorType)
        {
            // Arrays are enumerators of their element type
            if (iteratorType.IsArray) return iteratorType.ElementType;

            // String are enumerators of char
            if (StringType == iteratorType) return CharType;

            // Try to use an EnumerableItemType attribute
            if (iteratorType.IsClass)
            {
                IType enumeratorItemType = GetEnumeratorItemTypeFromAttribute(iteratorType);
                if (null != enumeratorItemType) return enumeratorItemType;
            }

            // Try to use a generic IEnumerable interface
            IType genericItemType = GetGenericEnumerableItemType(iteratorType);
            if (null != genericItemType) return genericItemType;

            // If none of these work, the type is an enumerator of object
            return ObjectType;
        }
TypeSystemServices