4 using System.Collections;
5 using System.Collections.Generic;
8 namespace SiliconStudio.Paradox.Internals
10 class LambdaReadOnlyCollection<TSource, T> : IReadOnlyList<T>
12 private IReadOnlyList<TSource> source;
13 private Func<TSource, T> selector;
18 this.selector = selector;
22 IEnumerator IEnumerable.GetEnumerator()
24 return GetEnumerator();
30 return source.Select(x => selector(x)).GetEnumerator();
34 public int Count {
get {
return source.Count; } }
37 public T
this[
int index]
39 get {
return selector(source[index]); }
IEnumerator< T > GetEnumerator()
LambdaReadOnlyCollection(IReadOnlyList< TSource > source, Func< TSource, T > selector)