acegiak

reverse ??

Dec 5th, 2013
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace System.Linq
  7. {
  8.     public static class LinqExtensions
  9.     {
  10.         public static TResult GetProperty<TSource, TResult>(this TSource source, Func<TSource, TResult> selector)
  11.         {
  12.             if (source == null)
  13.             {
  14.                 return default(TResult);
  15.             }
  16.             if (selector == null)
  17.             {
  18.                 throw new ArgumentNullException("selector can't be null");
  19.             }
  20.             return selector(source);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment