function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mikeegarmikeegar 

Instantiating sObject Lists

Hi,
     Is there anyway to instantiate sObject lists? i.e.

List <sobject> updates = new List <sobject>();

I can see lots of situations where it would be usefull to pass concrete sobjects cast as sObject typed arguments and work with them in lists / collections. Might bend the boundery between a strongly and weakly typed language but handy all the same.



Message Edited by mikeegar on 03-12-2008 08:30 PM
Best Answer chosen by Admin (Salesforce Developers) 
Ron HessRon Hess
currently you must specify which sobject you want a list of.

you could declare a class to hold one of each type you desire, then make a list of that

class s_object { Contact c; Account a; Case s; }

then you can build lists of s_object, and access the contents depending on which you have stored there.


Message Edited by Ron Hess on 03-12-2008 11:47 PM