A method can only return one value: that is all the definition allows.
To return multiple values, you either need to use an
out
or
ref
parameter as well:
public string getEMails(string staffid, out staffEmail)
{
...
staffEmail = ... ;
return SupervisorEmail;
}
public string getEMails(string staffid, ref staffEmail)
{
...
staffEmail = ... ;
return SupervisorEmail;
}
And call it passing the appropriate variable to the method:
string staffEmail;
string supEmail = getEMails("00001", out staffEmail);
string staffEmail = "none";
string supEmail = getEMails("00001", ref staffEmail);
Or, you could create a "container class" which holds both your parameters, and return that:
public class EMails
{
string Staff {get; set}
string Supervisor {get; set;}
}
...
public EMails getEMails(string staffid)
{
...
Emails em = new Emails;
em.Staff = StaffEmail;
em.Supervisor = SupervisorEmail;
return em;
}