Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public static class CommonExtensions
- {
- public static T With<T>(this T self, Action<T> apply, Func<bool> when)
- {
- if (when())
- apply?.Invoke(self);
- return self;
- }
- public static T With<T>(this T self, Action<T> apply, bool when = true)
- {
- if (when)
- apply?.Invoke(self);
- return self;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement