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, 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,
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,
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,
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Fernando Rodríguez |
last post by:
HI,
Is there an IEnumerator that enumerates a Collection from the back to the
begining?
Thanks
|
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...
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |