summaryrefslogtreecommitdiff
path: root/slips/src/app/Marina/Infrastructure/EnumerableMapper.cs
blob: 0ba9bcaf513396d40df695a25c16c55aff093951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System.Collections.Generic;

namespace Marina.Infrastructure {
	internal class EnumerableMapper< TIn, TOut > : IMapper< IEnumerable< TIn >, IEnumerable< TOut > > {
		public EnumerableMapper( IMapper< TIn, TOut > mapper ) {
			_mapper = mapper;
		}

		public IEnumerable< TOut > MapFrom( IEnumerable< TIn > input ) {
			foreach ( TIn item in input ) {
				yield return _mapper.MapFrom( item );
			}
		}

		private readonly IMapper< TIn, TOut > _mapper;
	}
}