Created
January 2, 2017 16:14
-
-
Save JKamsker/be1ce2073761fb96d126e528275ab191 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 Dictionary<U,T> dictConvert<U,T>(Dictionary<U,object> input) | |
{ | |
var outp = new Dictionary<U, T>(); | |
foreach (var item in input.Keys) | |
{ | |
if (input[item].GetType() != typeof(T)) | |
continue; | |
if (!outp.ContainsKey(item)) | |
outp.Add(item, (T)input[item]); | |
else | |
outp[item] = (T)input[item]; | |
} | |
return outp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment