I have a method that gets two parameters: the first is a Type to convert to and the second is the object to be converted. I tried to convert the object like this:
public static void method1(Type convertTo, object toBeConverted)
{
toBeConverted = (convertTo)toBeConverted;
}
But when I do that I get an error: "convertTo is a variable but is used like a type". How can I make this casting work(without checking the type of convertTo and converting according to this type)?