Click here to Skip to main content
15,888,527 members
Home / Discussions / C#
   

C#

 
AnswerRe: Convert code .Net4.0 to code .Net 2.0 Pin
CHill6021-Apr-16 22:33
mveCHill6021-Apr-16 22:33 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846725-Apr-16 15:24
Member 245846725-Apr-16 15:24 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
CHill6026-Apr-16 1:07
mveCHill6026-Apr-16 1:07 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846727-Apr-16 13:53
Member 245846727-Apr-16 13:53 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
CHill6028-Apr-16 0:54
mveCHill6028-Apr-16 0:54 
Question'out' keyword, to use or not to use Pin
Foothill19-Apr-16 8:35
professionalFoothill19-Apr-16 8:35 
AnswerRe: 'out' keyword, to use or not to use Pin
clapclap19-Apr-16 9:05
clapclap19-Apr-16 9:05 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 9:24
professionalFoothill19-Apr-16 9:24 
Sorry I didn't clarify in the question, but I didn't indicate that exception handling was implied. There are cases where success doesn't mean that the function ran without error and that using out could make the function more useful.

Example
C#
// Let's say that you run a search to see if a particular product was on sale
public bool IsProductOnSale(guid productId, out Guid[] productResellerIds)
{
  // This function runs a query against the database to see if this particular product has references in the 'on sale' reference table.
  // If it has references, it returns true also sets the array of resellers that sell that product.
  // The data for which seller has the item on sale is returned in the product query.
}

It's not the best example without a better understanding of the overall context. I'm just saying, if you have what you need already, why write multiple functions for what could be handled in one?
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

GeneralRe: 'out' keyword, to use or not to use Pin
Sascha Lefèvre19-Apr-16 9:29
professionalSascha Lefèvre19-Apr-16 9:29 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 9:51
professionalFoothill19-Apr-16 9:51 
GeneralRe: 'out' keyword, to use or not to use Pin
F-ES Sitecore21-Apr-16 0:26
professionalF-ES Sitecore21-Apr-16 0:26 
AnswerRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 11:08
professionalSander Rossel19-Apr-16 11:08 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 11:38
professionalFoothill19-Apr-16 11:38 
GeneralRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 12:24
professionalSander Rossel19-Apr-16 12:24 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill19-Apr-16 14:06
professionalFoothill19-Apr-16 14:06 
GeneralRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 21:25
professionalSander Rossel19-Apr-16 21:25 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 5:14
professionalFoothill20-Apr-16 5:14 
GeneralRe: 'out' keyword, to use or not to use Pin
Brisingr Aerowing20-Apr-16 4:23
professionalBrisingr Aerowing20-Apr-16 4:23 
GeneralRe: 'out' keyword, to use or not to use Pin
F-ES Sitecore21-Apr-16 0:33
professionalF-ES Sitecore21-Apr-16 0:33 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill21-Apr-16 4:39
professionalFoothill21-Apr-16 4:39 
GeneralRe: 'out' keyword, to use or not to use Pin
Richard MacCutchan19-Apr-16 20:46
mveRichard MacCutchan19-Apr-16 20:46 
GeneralRe: 'out' keyword, to use or not to use Pin
Sander Rossel19-Apr-16 21:26
professionalSander Rossel19-Apr-16 21:26 
GeneralRe: 'out' keyword, to use or not to use Pin
Mycroft Holmes19-Apr-16 21:54
professionalMycroft Holmes19-Apr-16 21:54 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 5:03
professionalFoothill20-Apr-16 5:03 
GeneralRe: 'out' keyword, to use or not to use Pin
Sander Rossel20-Apr-16 5:59
professionalSander Rossel20-Apr-16 5:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.