I have a block of code where a piece of the lambda expression is used again and again. How can store this logic so that i can reuse this expression piece?
Eg: lets take
Func func = (map => ((((map.User.Key ==_users.PublicUser.Key || map.User.Key == _users.CurrentUser.Key) && map.AccessLevel.ToAccessLevel() == AccessLevel.Read)).Count() > 0));
EDIT:
you could try something like this.
class MyClass{ Func func = null; MyClass() { func = (map => ((((map.User.Key ==_users.PublicUser.Key || map.User.Key == _users.CurrentUser.Key) && map.AccessLevel.ToAccessLevel() == AccessLevel.Read)).Count() > 0)); } ... ... }