I am trying to use the LINQ to CSV project in silverlight (its a great project), because its open sourced i figured i could just recompile as a silverlight class library but unfortunately it appears to use a feature not available in silverlight. The TypeDescriptor.GetConverter method.
It uses this to find type converters to properly parse the csv columns to their corresponding CLR types. I have no problem making changes to the linqtocsv sources to make it work in Silverlight, but i just don’t know what an equivalent operation would be in silverlight. Various google searches have brought me to this page, but all that says is that the XAML parser has a way of doing this (but it doesn’t say how to access this functionality).
In a nutshell, the question is:
how do i replicate the functionality of TypeDescriptor.GetConverter?
I don’t necessarily need an exact drop in replacement, i just want to know a good way to do this without hardcoding a bunch of type <—> typeconverter associations.
On the light frameworks you have limited options; I wouldn’t shy away from a little hard-coding, especially if you only need to support the core types. It will also be simpler and faster than the full
TypeConverteroption. Something like: