matching a condition in a list

  • Thread starter Thread starter Masahiro Ito
  • Start date Start date
Hi Mahahiro,

Maybe I miss something and although I don't find it the nices instruction,
this should shorten your code in my opinion.

\\\
If Staff.Count = 10 or Staff.Count = 15 or Staff.Count = 23 or
Staff.Count = 14 Then
Console.writeline(Staff.Count.tostring)
End If
///
with select
\\\
Select Case Staff.Count
Case 10,15,23,14
Console.writeline(Staff Count.toString)
' any other instruction
End Select
////

However when I see something wrong, tell me?

Cor
 
Larry Serflaten said:
It allows people to develop a character judgement based on your participation.
When you don't supply a name, people can only assume you don't want to be
held responsible for your contributions. If you are not willing to take on that
sort of responsibility, then that is a major strike in any character assessment.

There is no chane you can build as good a reputation with an alias as can
be done by posting under your real name. Everyone knows if you trash the
reputation of that name you can simply come back under a new name, so
you basically build no reputation at all. If you have no reputation for being
credible, then you have no credibility either.



If you, or anyone, has a problem with some post, then post your own response
and let the original poster decide who to listen to. There is no need to throw
insults and possibly start off a round of personal attacks. Your using an alias
is no shield, yet throwing insults from a nameless account is about the only thing
an alias is good for. There are no other good reasons for it.


Yeah right....

LFS

I'm not going to spill to much words on this because this is going OT
but Larry is right, if you're realy sure of yourself why not use your
real name? But maybe whatshisname is part of a group called: "De beste
stuurlui staan aan wal"
I think cor can read this so maybe he can help me with the english
translation, now I'm going back to work.

gr Peter
 
Hi Peter,

Although there is no bad word in your sentence I think it is better to make
this End Of Thread.

When you really want the translation than I can give it to you.

Cor
 
Whatshisname said:
I have a very simple question. If I used my real name how would you validate that it's really me? If I say my name is Jim
Myers, how would you prove that I'm am or that I am not?

That is a valid point. But, if you say you're Jim Myers, and all the posts from Jim Myer
on right on the mark, then that gets noticed. The fact that Jim uses his real name, or
appears to, gets noticed. All those add up to increasing credibility. Aliases detract
from trust. How can you trust someone who does not even supply their own name?

One last thing, people come here (most not using their real name, if you didn't notice) to get their questions answered, and I
don't think they care if someone is using their real name or not.

Both of those are your opinion only. I see more names, or what appear to be real names,
than I do anything else, so you go ahead and prove they are aliases, OK?

The point is, people have a choice at being honest, or not, at being helpful, or not, and so
on. By using aliases, you tell the world that you do not want to be recognised, that you
would rather not associate your name with the activities you engage in. Its your choice,
but that choice also reflects on what others think about you. And their perceptions are
really about you, whether you use an alias or not. A person who does not want to be
associated with what they engage in leaves significant doubt about their commitment....

LFS
 
Hallo Cor,

het was inderdaad OT aan het gaan en daarom is dit ook mijn laatste
post in deze thread. Ik ben wel nieuwsgierig naar de engelse vertaling
van "de beste stuurlui staan aan wal" Want ik heb dat ooit geweten,
maar ik kan er niet meer opkomen :-) Nu ga ik terug aan het werken en
dus terug naar .NET
 
* "Cor Ligthert said:
Maybe I miss something and although I don't find it the nices instruction,
this should shorten your code in my opinion.

You blame me for writing a soltion that does actually exactly the same
as yours and tell me that I don't understand 'IN'.
However when I see something wrong, tell me?

There is something terribly wrong, I think.
 
* (e-mail address removed) (Piedro) scripsit:
het was inderdaad OT aan het gaan en daarom is dit ook mijn laatste
post in deze thread. Ik ben wel nieuwsgierig naar de engelse vertaling
van "de beste stuurlui staan aan wal" Want ik heb dat ooit geweten,
maar ik kan er niet meer opkomen :-) Nu ga ik terug aan het werken en
dus terug naar .NET

LOL!
 
Hi Herfried,
You blame me for writing a soltion that does actually exactly the same
as yours and tell me that I don't understand 'IN'.

First of all, I do not blame you, I think that you are human and just like
me can oversee sometimes things, and than I make you attent on it.

To point you on that sentence of the OP cannot be called blaiming in my
idea. When you are than telling there is no array in it is not an answer,
the OP tried to give all types of arrays and you did choose one he had not
called. And on that answer you got reactions, however not from me.
There is something terribly wrong, I think.
What is terrible wrong, because the solution is not the same, what I wrote
is shorter, easier, more to the point and you can used with a lot of
statements in it. However as I said, there are situations where your
solution can be a fine one.

And therefore I am curious what is *terrible* wrong?

Cor
 
* "Cor Ligthert said:
First of all, I do not blame you, I think that you are human and just like
me can oversee sometimes things, and than I make you attent on it.

You do the same as I do and then tell me that I oversee something?
That's what I don't understand. I am always glad to be made aware of
something I missed, and I appreciate it if people show me where and
what I missed.
To point you on that sentence of the OP cannot be called blaiming in my
idea. When you are than telling there is no array in it is not an answer,
the OP tried to give all types of arrays and you did choose one he had not
called. And on that answer you got reactions, however not from me.

That's not what I am talking about.

BTW: 'Select Case' is a black box. In C#, 'switch'
is compiled to a 'Hashtable' in some situations. Did you think about
that? No. Just to make sure you don't get me wrong: That's AFAIS not
the case for VB.NET, but who says that they don't change it?
What is terrible wrong, because the solution is not the same, what I wrote
is shorter, easier, more to the point and you can used with a lot of
statements in it. However as I said, there are situations where your
solution can be a fine one.

It's less flexible than mine (with Jay's correction).
And therefore I am curious what is *terrible* wrong?

....
 
HI Herfried,

In another thread you will read that I do not like the switch, however just
on historical grounds. (It is in the same group as the GoTo, and you know I
think how I react on that)

The select case however is in VB.net to a good set of instructions, so I
would not know why they would go back to the past.

The OP said "no arrays", so he had probably tried that himself already,
however the Select was not in his message, maybe he has the same feelings
about the Switch as I have.

Your solution is whatever Jay says not the right one for the problem from
the OP.

Cor
 
Cor,

* "Cor Ligthert said:
In another thread you will read that I do not like the switch, however just
on historical grounds. (It is in the same group as the GoTo, and you know I
think how I react on that)

The select case however is in VB.net to a good set of instructions, so I
would not know why they would go back to the past.

I was talking about what 'switch' may be compiled to, and there is no
guarantee that this is/will be never done with VB.NET's 'Select Case'.
The OP said "no arrays", so he had probably tried that himself already,

.... then he will be glad with a working solution using an array.
however the Select was not in his message, maybe he has the same feelings
about the Switch as I have.

Your solution is whatever Jay says not the right one for the problem from
the OP.

It is, I am sure.
 
Hi Herfried,

Probably not this week, however you can wait on it that sooner or later you
get an solution with an Ilist or an Icollection from me as an alternative on
an answer from you.

:-) Now I stop with it.

Is as we in Holland say, bringing water to the sea, however that is much
more work from Austria than from here of course (The dutch/english word sea,
not the german one).

:-)

Cor
 
Herfried K. Wagner said:
Cor,



I was talking about what 'switch' may be compiled to, and there is no
guarantee that this is/will be never done with VB.NET's 'Select Case'.


this is what Cor's proposed Select Case generates in IL:

..method public static void Main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 89 (0x59)
.maxstack 2
.locals init ([0] int16 x,
[1] int16 _Vb_t_i2_0)
IL_0000: nop
IL_0001: ldc.i4.s 14
IL_0003: stloc.0
IL_0004: nop
IL_0005: ldloc.0
IL_0006: ldc.i4.s 10
IL_0008: sub
IL_0009: switch (
IL_0048,
IL_0056,
IL_0056,
IL_0056,
IL_0048,
IL_0048,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0048)
IL_0046: br.s IL_0056
IL_0048: nop
IL_0049: ldloca.s x
IL_004b: call instance string [mscorlib]System.Int16::ToString()
IL_0050: call void [mscorlib]System.Console::WriteLine(string)
IL_0055: nop
IL_0056: nop
IL_0057: nop
IL_0058: ret
} // end of method Module1::Main
 
Liz,

* "Liz said:
I was talking about what 'switch' may be compiled to, and there is no
guarantee that this is/will be never done with VB.NET's 'Select Case'.


this is what Cor's proposed Select Case generates in IL:

.method public static void Main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 89 (0x59)
.maxstack 2
.locals init ([0] int16 x,
[1] int16 _Vb_t_i2_0)
IL_0000: nop
IL_0001: ldc.i4.s 14
IL_0003: stloc.0
IL_0004: nop
IL_0005: ldloc.0
IL_0006: ldc.i4.s 10
IL_0008: sub
IL_0009: switch (
IL_0048,
IL_0056,
IL_0056,
IL_0056,
IL_0048,
IL_0048,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0056,
IL_0048)
IL_0046: br.s IL_0056
IL_0048: nop
IL_0049: ldloca.s x
IL_004b: call instance string [mscorlib]System.Int16::ToString()
IL_0050: call void [mscorlib]System.Console::WriteLine(string)
IL_0055: nop
IL_0056: nop
IL_0057: nop
IL_0058: ret
} // end of method Module1::Main

Yep. As mentioned above, in C# 'switch' is compiled to a 'Hasthtable'
lookup for a certain number of strings (AFAIR), but that's not the case
for VB.NET, and not in this case.
 
Back
Top