I have 10 different classes, but below are two for the purpose of this question :
public class Car
{
public int CarId {get;set;}
public string Name {get;set;}
}
public class Lorry
{
public int LorryId {get;set;}
public string Name {get;set;}
}
Now I have a function like
public static object MyFunction(object oObject, string sJson)
{
//do something with the object like below
List<oObject> oTempObject= new List<oObject>();
oTempObject = JsonConvert.DeserializeObject<List<oObject>>(sJson);
return oTempObject;
}
What I'm wanting to do is pass the object I create like (oCar) below to the function.
Car oCar = new Car();
My question is how can I pass a object of a different type to the same function ?