Tuesday, June 23, 2015

gitignore file repository

github hosts a repository for .gitignore files. C# developers are interested in VisualStudio template.
To make NCrunch ignored I had to add additional line:

Git remove files that were pushed but are added to .gitignore file

git rm -r --cached . 
git add .
git commit -am "Remove files ignored in .gitignore"

IEnumerable Sum extension for complex type

I was not able to find a simple/working example in internet. This is how to do it:
public static Money Sum<T>(this IEnumerable<T> data, Func<T, Money> selector)
            var money = new Money(0);
            money = data.Select(selector.Invoke).Aggregate(money, (current, selectedMoney) => current + selectedMoney);
            return money;