The question itself is incorrect. You cannot possibly convert this fragment of code to generic. You can add a generic parameters to a type declaration (it will make an incomplete generic type, a complete type should be obtained by instantiation with concrete generic parameters) or to a method declaration.
You already used generic types
KeyValuePair
and
Tuple
, now you need to create your own type or method using generics. In a pinch, look at the declarations of the two generic types mentioned above, to see the syntax. And then read on generic declarations in MSDN documentation. This is really, really simple:
http://msdn.microsoft.com/en-us/library/512aeb7t.aspx[
^].
As you did not provide a base for turning anything into generics (no type or method declaration), at this moment making up a code sample would be of little help. If you read documentation, it will be a lot easier.
—SA