|
I've used a similar approach occasionally:
class DoProcArgs
{
public bool UpdatesLiveDB { set; get; };
public int Response { set; get; };
public string BlahBlahBlah { set; get; };
public DoProcArgs()
{
UpdatesLiveDB = false;
Response = 42;
BlahBlahBlah = "Meh";
}
}
void DoProc(DoProcArgs);
DoProc(new DoProcArgs() { Response = 84 });
DoProc(new DoProcArgs() { BlahBlahBlah = "Yup", UpdatesLiveDB = true }); This works in Visual C# 2008. Visual C# 2010 introduced named and optional arguments[^].
Software Zen: delete this;
|
|
|
|
|
enum s, maybe. Pity about automatic conversions.
enum DangerLevel
{
Safe,
FamilyJewelsInASling
};
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
And we just call this argument "Gladys"?
And is this the right forum for an argument?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: And is this the right forum for an argument? Well, do you want to have the full argument, or were you thinking of taking a course?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
I'm sorry is this the five minute argument or are you here for the full half hour?
|
|
|
|
|
I've told you once.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
Yes I did!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
No you didn't. (Spam, spam, spam, spam, spam, spam, spam, spam?)
|
|
|
|
|
This argument is no more. It's expired and gone to meet its maker. This is a late argument. It's a stiff. Bereft of life, it rests in peace. If you hadn't nailed it to the thread, it would be pushing up the daisies. It's rung down the curtain and joined the choir invisible. This is an ex-argument.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
And now for something completely different.
|
|
|
|
|
RUs123 wrote: And now for something completely different. A man with a tape recorder up his nose?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
A hovercraft full of eels.
|
|
|
|
|
And now:
Number 1 - The LARCH!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
Johnny J. wrote: A man with a tape recorder up his nose? Tell me it snot so!
(Please speak a bit louder and directly to my face, thank you)
Sniffle.
Sorry - what was that, again?
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
OriginalGriff wrote: "Gladys"
Special *characters* not allowed
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
OriginalGriff wrote: And we just call this argument "Gladys"?
Or (as per your post above this one) if via Microsoft, it would be called "gladys".
|
|
|
|
|
That's why I use Chrome instead of Edge...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Not GladysEmmanuelleLookYouRonnie ?
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
You know such a 'true ', 'false ' verbosity is for sissies.
Real programmers write
DoProc(obj,2,0,1,0,1);
|
|
|
|
|
I see a '2' there. Bro you missed it. This is still not for real men. Rofl
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
People who write methods with multiple bool arguments are the ones who should be fired!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
True!
[OldNewThing^]
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
(Note to self: In future, use Enums with only two valid values)
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
It's a better option than having multiple bool arguments. Or even one bool argument, if it's not obvious what the value means.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|