>>Hi,
>>
>>I'm trying to adjust a method so I can get two bits of information out of it. Previously I was just returning an error code, now I would like to return an error message along with the code. I found one way to do this is to use out parameters, so I adjusted my methods definition to this:
>>
>>
public void SendEmails(Guid emailPK, string subject, string html, out int errorCode, out string errorMessage)
>>
>>When I try calling this method like this:
>>
>>
int errorCode;
>>string errorMessage;
>>emailNotifications.SendEmails(emailPK, email.blk_subject, email.blk_html, out errorCode, out errorMessage);
>>
>>I get this error:
>>
>>"No overload for method 'SendEmails' takes 5 arguments"
>>
>>Maybe it's too early in th emorning for me but I think I'm counting correctly.
>>
>>Can anybody help enlighten me, please?
>
>You may try to initialize your variables, before send them to the code:
>
>int errorCode = 0;
>string errorMessage = "";
>emailNotifications.SendEmails(emailPK, email.blk_subject, email.blk_html, out errorCode, out errorMessage);
>
>Not sure, though.
>What IntelliSense said?
Hey Boris,
I went and changed the code to use a KeyValuePair and now that I'm trying to duplicate th eproblem I created a separate SendEmails method like this:
public void SendEmails(Guid emailPK, string subject, string html, out int errorCode, out string errorMessage)
{
errorCode = 0;
errorMessage = "";
}
and it works!
So I guess that something within the original method, which I have now cut out of this new method, was causing a problem. I'll try to do some more digging to understand this.