Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. private Dictionary<string, T> FetchDictionary<T>() where T:IConvertible
  2. {
  3.  
  4. if (typeof(T) == typeof(int))
  5. {
  6. return IntsDictionary.ToDictionary(x=> x.Key,x=> (T)Convert.ChangeType(x.Value,typeof(T)));
  7. }
  8.  
  9. if (typeof(T) == typeof(string))
  10. {
  11. return StringsDictionary.ToDictionary(x => x.Key, x => (T)Convert.ChangeType(x.Value, typeof(T)));
  12. }
  13.  
  14. return DoublesDictionary.ToDictionary(x => x.Key, x => (T)Convert.ChangeType(x.Value, typeof(T)));
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement