You need to sign in to do that
Don't have an account?
Scott0987
use list as method signature
I think a signature is what I am looking for but am not sure. Here is what I want to do. Some methods when you pass information to them have something like
public void mymethod(string abcd){
method here...
}
then when calling the method you have to pass a string onto the method. I would like to setup something similar but have it be a list that is passed on. So something like
public void mymethod(list abcdList){
method here....
}
I think that area is called a signature, but am not sure. Can someone point me in the right direction?
Scott,
You need to create a class and methid like below :-
public class myClass {
public void myMethod(List<Contact> conList, List<Id> ChildIds){
// .... some code here
}
}
then,
You need to create an instance of your class, like this:
//Create the instance
myClass sm = new myClass();
//Call the method
sm.myMethod(<Pass contact list here>);
The other way is to declare the method static like below :-
public class myClass {
public static void myMethod(List<Contact> conList, List<Id> ChildIds){
// .... some code here
}
}
and then call it directly.
myClass.myMethod(<Pass the contact list here>)
If this answers your query,please mark it as solution so that other can get benefited...
Regards,
Vinit