Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
No Overload takes 5 arguments
Message
De
20/09/2013 12:02:31
 
 
À
20/09/2013 11:40:35
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01583574
Message ID:
01583739
Vues:
42
>>>But unless the called method needs to access existing values using 'ref' is a waste of bandwidth.
>>
>>Hadn't thought about that but with and empty varchar going in for an errormessage are we really talking about a lot of bandwidth?
>
>In that instance - No. But still unnecessary. But if, for example, the parameter is a large object which needs to be marshalled then it is more significant.
>I'd argue that, just from a best-practice POV, if the called method doesn't require the parameter to be passed in then 'out' is best.

I see your point. With the out param, where does the return value show up in the debugger? I don't remember what it was I ran into that drew me to the by ref but it seems it had to something to do with debugging. The out param is not defined before the call to the function, is it? I really need to look at all that again as I realize now there is some stuff there I'm fuzzy on having not used that signature for a while.


>
>>
>>>
>>>>Sorry not time to read the thread right now but the first time I looked at using out params I ultimately smacked my head and realized I'd forgotten I could pass in by reference.
>>>>
>>>>>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?


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform