I have a variable declared as var
that I want to implicitly declare. I have used the code Console.WriteLine(returnData.GetType();
which returns ConsoleApp1.GreenGlue[]
-> which I do not follow on how to change the type of var returnData;
This is how the syntax is set...snippet if more code needs to be added let me know.
static void Main(string[] args)
{
var returnData = JsonConert.DeserializeObject<GreenGlue[]>(reply);
}
public class GreenGlue
{
public string BC { get; set; }
public List<BL> BL { get; set; }
}
var
is an implicitly declared variable, meaning the compiler will infer the type from the right-hand side.
Since you are using Json.Net, you will have to change the generic parameter for DeserializeObject
whatever result you want.