throwing ArgumentNullException with multiple parameters

  • Thread starter Thread starter Andy B.
  • Start date Start date
Jack Jackson said:
If a function is defined as:

Function SomeFunc(i As Integer)

How are you going to call that function passing anything but an
Integer?

You have misquoted. The definition given was
public sub 3Parameters(ByVal one as int, ByVal two as int, ByVal three as
int)

We do not know that the function has actually been defined as you state. If
it was defined in some other way then something other than a valid integer
could be passed, and OP's statement that null needs to be tested for is
correct.
 
James said:
You are using selective quoting. You have ignored the point of the
question, namely "And I need to test the 3 parameters for null (none
of them can be null), how would I throw the ArgumentNullException to
deal with all 3 parameters?"

If OP has a need to test the parameters for null then there is an
implication that they can, in fact, be null.

No, as he wrote "none of them can be null". Therefore it's a contradiction
and the reason for my (still open) question.

It was obvious to everyone that "ByVal one as int" was meant to be "ByVal
one as Integer" and it was not copied from the code editor. I don't
understand why you don't accept this.


Armin
 
Armin Zingler said:
No, as he wrote "none of them can be null". Therefore it's a contradiction
and the reason for my (still open) question.

It was obvious to everyone that "ByVal one as int" was meant to be "ByVal
one as Integer" and it was not copied from the code editor. I don't
understand why you don't accept this.


Armin

No, that's not obvious.
I read it as none of them can be accepted to be Null by the routine.

/Henning
 
Armin Zingler said:
No, as he wrote "none of them can be null". Therefore it's a contradiction
and the reason for my (still open) question.
What OP actually meant with that comment was "none of them can be processed
if it is null". If it is interpreted that way the question makes sense - OP
needs to test for null. If it is interpreted your way the question makes no
sense at all, as you commented. My interpretation seems more obvious to me,
but, importantly, it makes the question meaningful.
It was obvious to everyone that "ByVal one as int" was meant to be "ByVal
one as Integer" and it was not copied from the code editor. I don't
understand why you don't accept this.
Again, you are ignoring the rest of the question. If OP meant that the
items were declared as Integer, why is he enquiring about testing for null?
The question makes no sense. If OP actually means that he is going to use
the values as integers, but they could be null (and therefore are actually
declared as some other type) then the question makes sense and deserves to
be answered, not dismissed as irrelevant.

What has happened here is that a somewhat confusing question has been
interpreted by two of the first three responders in a literal sense that was
clearly inappropriate, and then dismissed as a meaningless question. It's
an attitude that I see too frequently in the group. What is so difficult
about simply stating "You do realise, of course, that an integer cannot be
Null" and then answering the question that was asked?
 
James said:
My interpretation [...]

Well, IMO there's no room for interpretation because it's clear. That was my
point. Anyway, as Cor correctly says, the OP didn't ever respond, so....


Armin
 
Back
Top