I\'m trying to write generic method to cast types. I want write something like Cast.To(variable) instead of (Type) variable. My wrong versi
Cast.To(variable)
(Type) variable
Maybe not what you what to do exactly, but that will works:
public class Cast { public static targetType To(object o) { return (targetType)((sourceType) o); } }
But well, such a method seems useless to me...