Created
August 5, 2015 18:59
-
-
Save ArtemAvramenko/65062e72e6c7948c1bf0 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 class AnonymousTypeHelper | |
{ | |
public static T Cast<T>(T typeHolder, object x) | |
{ | |
return (T)x; | |
} | |
public static T GetNull<T>(T typeHolder) where T : class | |
{ | |
return null; | |
} | |
public static Dictionary<TKey, TValue> CreateDictionary<TKey, TValue>(TKey keyTypeHolder, TValue valueTypeHolder) | |
{ | |
return new Dictionary<TKey, TValue>(); | |
} | |
public static List<TValue> CreateList<TValue>(TValue valueTypeHolder) | |
{ | |
return new List<TValue>(); | |
} | |
public static IQueryable<TValue> GetNullIQueryable<TValue>(TValue valueTypeHolder) | |
{ | |
return (IQueryable<TValue>)null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment