I have a generic method where I want to do something special for Strings
.
I've found DirectCast(DirectCast(value, Object), String)
to get the String
value (when I've already confirmed GetType(T) Is GetType(String)
) and DirectCast(DirectCast(newvalue, Object), T)
as mentioned in a number of answers to similar questions works.
But is there anything more elegant and is it performant?