/ Published in: C#
URL: http://hobbitwerk.brinkster.net
Methinks this is a bad idea but it is a suggested use of generics from the .NET 2.0 Generics Wrox book
Expand |
Embed | Plain Text
public static Dictionary<X, G> BuildDictionary<X, G>(string db, string keyColumn, string valColumn) { while (rd.Read()) { myDictionary.Add((X)rd[keyColumn], (G)rd[valColumn]); // ? good idea? } rd.Close(); return myDictionary; }
Comments
Subscribe to comments
You need to login to post a comment.

The calling code needs to know what datatype the two columns returned are... This would be ok in a data access layer, but personally I would not even do it there.