Big Monty
asked on
pass data type into function
I have the following two functions, their only difference is the type that it returns. is there any simple way to combine these two functions into a single function and pass the data type as a parameter?
public List<CCG_OrderData> getCCG_ItemData(string url)
{
string jsonData = AddBracketsToJsonString(getJsonData(url));
return JsonConvert.DeserializeObject<List<CCG_OrderData>>(jsonData);
}
public List<CCG_ReceivedOrders> getCCG_ItemData2(string url)
{
string jsonData = AddBracketsToJsonString(getJsonData(url));
return JsonConvert.DeserializeObject<List<CCG_ReceivedOrders>>(jsonData);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect, just what I was looking for
ps. If you look closely you will see JsonConvert.DeserializeObj