Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No Overload takes 5 arguments
Message
From
19/09/2013 08:39:14
 
 
To
19/09/2013 08:21:18
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01583574
Message ID:
01583578
Views:
44
Likes (1)
Throw an exception when there's an error. Returning an error code is very C/C++ like and is discouraged in .Net.


>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?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform