+ 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'));

 

?