Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
GeneralRe: Semi-crosspost: Recompiling - but the assembly isn't updated Pin
Jan R Hansen22-May-04 22:23
Jan R Hansen22-May-04 22:23 
GeneralRe: Semi-crosspost: Recompiling - but the assembly isn't updated Pin
Heath Stewart23-May-04 4:01
protectorHeath Stewart23-May-04 4:01 
GeneralReturning multiple values from methods Pin
bjoernen22-May-04 12:44
bjoernen22-May-04 12:44 
GeneralRe: Returning multiple values from methods Pin
Colin Angus Mackay22-May-04 13:12
Colin Angus Mackay22-May-04 13:12 
GeneralRe: Returning multiple values from methods Pin
bjoernen22-May-04 21:53
bjoernen22-May-04 21:53 
GeneralRe: Returning multiple values from methods Pin
Marc Clifton22-May-04 15:03
mvaMarc Clifton22-May-04 15:03 
GeneralRe: Returning multiple values from methods Pin
bjoernen22-May-04 22:18
bjoernen22-May-04 22:18 
GeneralRe: Returning multiple values from methods Pin
Marc Clifton23-May-04 2:59
mvaMarc Clifton23-May-04 2:59 
bjoernen wrote:
Nobody uses input structs, because the C# language handles a collection of input parameters elegantly.

Ah, but I disagree. Input structs are very useful too! For example you can have overloaded constructors that accept different parameters and types. You can set defaults, and do validation. An input struct is a very nice middle layer between the caller and the callee.

bjoernen wrote:
Lets say you have 10 different methods that each return a result object, but from different classes, for instance Point, Rectangle, ArrayList, etc (some of the framework structs and classes). Lets say you also want to be able to tell if the operation went ok, for all those methods, so you'll need a second output parameter of type bool. Would you go about creating 10 output structs to solve that? Or would you use "out"-parameters? Neither is both elegant and productive.

In practice, no. But in theory, if I were to really apply my own rules of programming to myself 100% of the time, then yes, I'd create different structs. And I'd make the methods consistent, so that they return a bool, indicating success (although I suppose throwing an exception is the neuveau way now, blech).

IMO, the problem, here, is that for all the cool features of something like Visual Studio, it does very little to help in good implementation. If you had a tool that would automatically create the structs for you, then it would be easy and accepted practice. And then, if you needed to modify the struct, you wouldn't have to fix up 10's or 100's of callers to match the new method signature, or create an abortion of overload methods. Obviously though, there is a line between practical and silly. Unfortunately, there are no good guidelines. The current state of [edit]Computer Science[/edit] is a joke, IMO, but that's another matter. It's just that your question has touched on this subject, which is something I like to get up on my soapbox and rant about. Smile | :)

Marc

Microsoft MVP, Visual C#
MyXaml
MyXaml Blog
GeneralRe: Returning multiple values from methods Pin
bjoernen23-May-04 5:43
bjoernen23-May-04 5:43 
GeneralRe: Returning multiple values from methods Pin
Heath Stewart23-May-04 3:59
protectorHeath Stewart23-May-04 3:59 
GeneralRe: Returning multiple values from methods Pin
leppie22-May-04 19:45
leppie22-May-04 19:45 
GeneralRe: Returning multiple values from methods Pin
Heath Stewart23-May-04 3:56
protectorHeath Stewart23-May-04 3:56 
GeneralRe: Returning multiple values from methods Pin
bjoernen23-May-04 6:03
bjoernen23-May-04 6:03 
GeneralRe: Returning multiple values from methods Pin
MilesAhead24-May-04 7:34
MilesAhead24-May-04 7:34 
GeneralCausing a time delay within a method Pin
Anonymous22-May-04 11:57
Anonymous22-May-04 11:57 
GeneralRe: Causing a time delay within a method Pin
bjoernen22-May-04 12:55
bjoernen22-May-04 12:55 
GeneralRe: Causing a time delay within a method Pin
Colin Angus Mackay22-May-04 12:56
Colin Angus Mackay22-May-04 12:56 
GeneralRe: Causing a time delay within a method Pin
Marc Clifton22-May-04 15:00
mvaMarc Clifton22-May-04 15:00 
GeneralStackFrame Pin
TuringTest122-May-04 11:16
TuringTest122-May-04 11:16 
GeneralRe: StackFrame Pin
Colin Angus Mackay22-May-04 13:03
Colin Angus Mackay22-May-04 13:03 
GeneralRe: StackFrame Pin
Marc Clifton22-May-04 15:11
mvaMarc Clifton22-May-04 15:11 
GeneralRe: StackFrame Pin
TuringTest122-May-04 16:33
TuringTest122-May-04 16:33 
GeneralRe: StackFrame Pin
leppie23-May-04 2:22
leppie23-May-04 2:22 
GeneralRe: StackFrame Pin
TuringTest123-May-04 10:47
TuringTest123-May-04 10:47 
GeneralRe: StackFrame Pin
Heath Stewart23-May-04 3:53
protectorHeath Stewart23-May-04 3:53 

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.