Show
Ignore:
Timestamp:
11/25/08 06:08:11 (22 months ago)
Author:
Chuck.Esterbrook
Message:

Fixed: Cannot use for expressions on non-generic enumerables.
ticket:85

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/Cobra.Lang/Native.cs

    r1778 r1780  
    758758        } 
    759759 
     760        static public List<TOut> For<TIn, TOut>(IEnumerable list, ForGet<TIn, TOut> forGet) { 
     761                List<TOut> results = new List<TOut>(); 
     762                foreach (TIn item in list) 
     763                        results.Add(forGet(item)); 
     764                return results; 
     765        } 
     766 
     767        static public List<TOut> For<TIn, TOut>(IEnumerable list, ForWhereGet<TIn, TOut> forWhereGet) { 
     768                List<TOut> results = new List<TOut>(); 
     769                foreach (TIn item in list) { 
     770                        TOut value; 
     771                        if (forWhereGet(item, out value)) 
     772                                results.Add(value); 
     773                } 
     774                return results; 
     775        } 
     776 
    760777        static private void ProcessGetSliceArgs(int count, ref int? start, ref int? stop, ref int? step) { 
    761778                if (start==null)