Last active
August 29, 2015 14:04
-
-
Save pjmagee/32d35cf2c6f145efdf12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void PerformAs<TOut>(this IEntity item, Action<TOut> perform) where TOut : class, IEntity | |
| { | |
| var conversionResult = item as TOut; | |
| conversionResult.Perform(converted => perform(converted)); | |
| } | |
| public static IEnumerable<T> OrEmptyIfNull<T>(this IEnumerable<T> source) | |
| { | |
| return source ?? Enumerable.Empty<T>(); | |
| } | |
| // Current | |
| (owner as RetainedOrg).Perform(o => o.BusinessUnit.HasValue()); | |
| // Extension | |
| owner.PerformAs<RetainedOrg>(o => o.BusinessUnit.HasValue()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment