using System; using System.Reflection; namespace LeafWeb.Core.Utility { public class ParseInfoPropertyMatcherWithCache : ParseInfoPropertyMatcher where T: new() { private readonly Func _matchPropertyMemo; private readonly Func _matchPropertyExactMemo; public ParseInfoPropertyMatcherWithCache() { _matchPropertyMemo = Memoizer.ThreadsafeMemoize(base.MatchProperty); _matchPropertyExactMemo = Memoizer.ThreadsafeMemoize(base.MatchPropertyExact); } public override PropertyInfo MatchProperty(string title, int position) { return _matchPropertyMemo(title, position); } public override PropertyInfo MatchPropertyExact(string title, int position) { return _matchPropertyExactMemo(title, position); } } }