I have the following list definition in my Apex controller:
List<Object> mylist = new List<Object>();
And I would like to do something like:
mylist.add({
key : objKey,
label : objlabel,
property1 : objproperty1
});
This code gives an error. Is there any way to achieve such a data structure in Apex?
Best Answer
You need to create a Wrapper class for this.
Example :