Is there a way to pass an anonymous struct to an object constructor in C#?
I am using the struct for deserializing JSON from within the new object.
public class MyClass
{
public MyClass (List<object> NewObjects, ?anonymousStruct?)
{
NewObjects.Add (JsonConvert.DeserializeObject< anonymousStruct > (JsonString));
}
}
EDIT: To Clarify -> I wish to pass different kinds of structs into the class depending on what I need to deserialise, so I can't specify the struct ahead of time. The information is deserialised into the struct type and inserted into the list of objects.