473,411 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Searching on groups of enumerator's members


Hi,

If have an enumerator like :

public enum {
op1,
op2,
op3,
op4,
op5}
// real list will contain about 30 members.

And I want to, let's say, group them in odd and evens, just to say an
example.
Then, I would be want to be able to say :

if (myOp.OpX is in the list of odd operators)

or do :

if (myOp.OpX is in the list of even operators)
What 's the C# approach to do this ?

I would this in Delphi very easy, but I don't find the C#'s correspoding
approach.
Regards,
Nov 16 '05 #1
3 1192
return ((myOp.OpX % 2 == 0) ? "Even" : "Odd");

C# isnt my language so this might be wrong,

return iif(myOp.Opx Mod 2 = 0, "Even", Odd")

"Craig Kenisston" <Cr************@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP15.phx.gbl...

Hi,

If have an enumerator like :

public enum {
op1,
op2,
op3,
op4,
op5}
// real list will contain about 30 members.

And I want to, let's say, group them in odd and evens, just to say an
example.
Then, I would be want to be able to say :

if (myOp.OpX is in the list of odd operators)

or do :

if (myOp.OpX is in the list of even operators)
What 's the C# approach to do this ?

I would this in Delphi very easy, but I don't find the C#'s correspoding
approach.
Regards,

Nov 16 '05 #2

Jared :

Thanks for your input.
Actually I said "even and odds, just to say an example".

But I've just found how to group them :

public enum {
op1,
op2,
op3,
op4,
op5,
EvenOps = op2 | op4,
OddsOps = op1 | op3 | op5,
}
Regards,
"Jared" <@vb***********@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
return ((myOp.OpX % 2 == 0) ? "Even" : "Odd");

C# isnt my language so this might be wrong,

return iif(myOp.Opx Mod 2 = 0, "Even", Odd")

"Craig Kenisston" <Cr************@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP15.phx.gbl...

Hi,

If have an enumerator like :

public enum {
op1,
op2,
op3,
op4,
op5}
// real list will contain about 30 members.

And I want to, let's say, group them in odd and evens, just to say an
example.
Then, I would be want to be able to say :

if (myOp.OpX is in the list of odd operators)

or do :

if (myOp.OpX is in the list of even operators)
What 's the C# approach to do this ?

I would this in Delphi very easy, but I don't find the C#'s correspoding
approach.
Regards,


Nov 16 '05 #3
Craig,
So is the concept, the snippet just followed your example, you can still use
that block with your or'd variable.
Jared

"Craig Kenisston" <Cr************@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...

Jared :

Thanks for your input.
Actually I said "even and odds, just to say an example".

But I've just found how to group them :

public enum {
op1,
op2,
op3,
op4,
op5,
EvenOps = op2 | op4,
OddsOps = op1 | op3 | op5,
}
Regards,
"Jared" <@vb***********@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
return ((myOp.OpX % 2 == 0) ? "Even" : "Odd");

C# isnt my language so this might be wrong,

return iif(myOp.Opx Mod 2 = 0, "Even", Odd")

"Craig Kenisston" <Cr************@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP15.phx.gbl...

Hi,

If have an enumerator like :

public enum {
op1,
op2,
op3,
op4,
op5}
// real list will contain about 30 members.

And I want to, let's say, group them in odd and evens, just to say an
example.
Then, I would be want to be able to say :

if (myOp.OpX is in the list of odd operators)

or do :

if (myOp.OpX is in the list of even operators)
What 's the C# approach to do this ?

I would this in Delphi very easy, but I don't find the C#'s correspoding
approach.
Regards,



Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fernando Rodríguez | last post by:
HI, Is there an IEnumerator that enumerates a Collection from the back to the begining? Thanks
3
by: weeims | last post by:
Hi, When a user visits my site (ASP.NET + VB.NET), I need to know if they are in a particular AD security group in order to display the pertinant information. When I call UserLookup in code...
0
by: bcanter | last post by:
I found a file on the web that will allow you to enumerate groups but it was an .hta and the top level admins won't allow this. I need to give managers access to the groups so that when a new user is...
1
by: alamodgal | last post by:
hiiiiiii I have a problem in highlighting searching keyword.Actually im using this function for searching Public Function HighLight(ByVal Keyword As String, ByVal ContentFor As String) Dim...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.