fix some issues reported by resharper
add optional maxiumum parameter to Memoize(IEnumerable<T>)