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
pradyprady 

How to add into a list

I have a class

public with sharing class A {
   
     public String str         {get; set;}
    public cobj__c co   {get; set;}

    public A(String st)
    {
        str= st;
        co= null;
    }

}

 i also have a list of this class

list<A> LstA = new list<A>();

 How do i add values into this list?

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
iBr0theriBr0ther

How about :

 

list<A> LstA = new list<A>();

LstA.add(new A('test1'));

 

?