Is it possible to cast an object to a desired type using System.Type?
as the reference?
I had a search and the general consensus was no, although I was hoping there may be some aids introduced in C# 4.0 that could help me.
I.e. the below will not work, but the pseudocode is what I would like.
object o = null;
var t = typeof(string);
...
string foo = (t)o;
Edit: I need use XmlSerializer
to reconstruct / deserialize to the type stored in t
foo
to be? What are you really trying to achieve? Explaining the bigger picture would help a lot.