Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
Questionsimple radio button question Pin
dino20945-Mar-07 13:00
dino20945-Mar-07 13:00 
AnswerRe: simple radio button question Pin
Luc Pattyn5-Mar-07 13:21
sitebuilderLuc Pattyn5-Mar-07 13:21 
AnswerRe: simple radio button question Pin
Koocurrent5-Mar-07 15:02
Koocurrent5-Mar-07 15:02 
AnswerRe: simple radio button question Pin
engsrini5-Mar-07 18:42
engsrini5-Mar-07 18:42 
QuestionWindows Service Pin
Darkness845-Mar-07 12:41
Darkness845-Mar-07 12:41 
AnswerRe: Windows Service Pin
Luc Pattyn5-Mar-07 13:22
sitebuilderLuc Pattyn5-Mar-07 13:22 
QuestionTo activate flash or real player plug Ins in widgets Pin
mikkasava5-Mar-07 12:05
mikkasava5-Mar-07 12:05 
QuestionOpton to re-use code Pin
Glen Harvy5-Mar-07 11:53
Glen Harvy5-Mar-07 11:53 
QuestionIs it better to use args to return values or function type? Pin
BRShroyer5-Mar-07 11:13
BRShroyer5-Mar-07 11:13 
AnswerRe: Is it better to use args to return values or function type? Pin
led mike5-Mar-07 11:38
led mike5-Mar-07 11:38 
GeneralRe: Is it better to use args to return values or function type? Pin
Colin Angus Mackay5-Mar-07 13:52
Colin Angus Mackay5-Mar-07 13:52 
AnswerRe: Is it better to use args to return values or function type? Pin
Ed.Poore5-Mar-07 11:38
Ed.Poore5-Mar-07 11:38 
AnswerRe: Is it better to use args to return values or function type? Pin
netJP12L5-Mar-07 11:39
netJP12L5-Mar-07 11:39 
GeneralRe: Is it better to use args to return values or function type? Pin
DavidNohejl5-Mar-07 13:00
DavidNohejl5-Mar-07 13:00 
AnswerRe: Is it better to use args to return values or function type? Pin
Guffa5-Mar-07 12:47
Guffa5-Mar-07 12:47 
AnswerRe: Is it better to use args to return values or function type? Pin
DavidNohejl5-Mar-07 12:59
DavidNohejl5-Mar-07 12:59 
AnswerRe: Is it better to use args to return values or function type? Pin
Mundo Cani5-Mar-07 16:42
Mundo Cani5-Mar-07 16:42 
Generally, the second option is the best (for many of the reasons already mentioned) and is what you should use most of the time. There are, however, times when passing parameters by reference is useful. For example, a function may need to return multiple values (this is often a sign that refactoring is in order, but there are legitimate examples of this need). Also, when passing a large value type by value, the type must be copied. This takes extra memory and cycles. Because of this, it may be acceptable (and even neccessary) at times to pass a large value type by reference.

Also, when passing parameters by reference, C# requires the 'out' or 'ref' keywords. Although they are compiled into identical IL, when using the 'out' keyword, it is expected that the method being called will initialize the value. When 'ref' is used, it is expected that the calling method will initialize the value.

So, while you won't usually need (or want) to pass by reference, there are times when it is appropriate.

Ian

QuestionFile deleting Pin
SpeedBee5-Mar-07 11:09
SpeedBee5-Mar-07 11:09 
AnswerRe: File deleting Pin
Ed.Poore5-Mar-07 11:37
Ed.Poore5-Mar-07 11:37 
AnswerRe: File deleting Pin
Luc Pattyn5-Mar-07 13:28
sitebuilderLuc Pattyn5-Mar-07 13:28 
AnswerRe: How to convert object type into 'int' type? Pin
Are Jay5-Mar-07 9:41
Are Jay5-Mar-07 9:41 
GeneralRe: How to convert object type into 'int' type? Pin
Khoramdin5-Mar-07 9:51
Khoramdin5-Mar-07 9:51 
GeneralRe: How to convert object type into 'int' type? Pin
Colin Angus Mackay5-Mar-07 13:51
Colin Angus Mackay5-Mar-07 13:51 
QuestionDateTimepicker commercial replacement ? Pin
CAE5-Mar-07 8:45
CAE5-Mar-07 8:45 
Questionsend a wav file through a socket in C# Pin
trab0075-Mar-07 7:33
trab0075-Mar-07 7:33 

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.