473,405 Members | 2,338 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,405 software developers and data experts.

Enumeration sets


Please tell me there is an option for sets of enumeration in c# !?

eg : enum DataKind {dkSimple, dkComplex, dkCool
<DataKindSet> = Set of DataKind //Delphi style thoug

DataKindSet VariableofDataKindSet = new DataKindSet(dkSimple, dkCool)

No ?
Alternatives please

-Niti

Nov 16 '05 #1
3 1181
"=?Utf-8?B?Tml0aW4gS29zaHk=?=" <ni********@mail.com> wrote in
news:75**********************************@microsof t.com:

Please tell me there is an option for sets of enumeration in c#
!?!

eg : enum DataKind {dkSimple, dkComplex, dkCool}
<DataKindSet> = Set of DataKind //Delphi style though

DataKindSet VariableofDataKindSet = new
DataKindSet(dkSimple, dkCool);

No ?
Alternatives please!


http://www.codeproject.com/csharp/Sets.asp

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #2
Cheers Chris...looks interesting

I was thinking on using bit fields directly..
enum DataKind {dkSimple = 1, dkComplex = 2, dkCool = 4}

then do bitwise operations to manipulate the set, wherein the set itself could be just integer variables
int aSet = ((int)DataKind .dkSimple | (int)DataKind .dkCool ....et

-Nitin
Nov 16 '05 #3
"=?Utf-8?B?Tml0aW4gS29zaHk=?=" <ni********@mail.com> wrote in
news:E0**********************************@microsof t.com:
Cheers Chris...looks interesting.

I was thinking on using bit fields directly...
enum DataKind {dkSimple = 1, dkComplex = 2, dkCool = 4},

then do bitwise operations to manipulate the set, wherein the
set itself could be just integer variables int aSet =
((int)DataKind .dkSimple | (int)DataKind .dkCool ....etc

-Nitin


Yes, that can be done by using the FlagsAttribute:

[Flags]
enum DataKind {dkSimple = 1, dkComplex = 2, dkCool = 4};

int aSet = (int) (DataKind.dkSimple | DataKind.dkComplex);

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #4

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

Similar topics

1
by: Justin Wright | last post by:
I know that I can set up an enumeration as follows ( just typed in quick so may have syntax errors ): <xsd:simpleType name="colors"> <xsd:restriction base="xsd:string"> <xsd:enumeration...
8
by: aevans1108 | last post by:
Greetings I can't seem to inherit enumerated values from a globally defined type in my XML schema. XmlSchema.Compile() doesn't like it. Here's the schema. <?xml version="1.0"...
2
by: Mark | last post by:
Assume you have an enumeration like PhoneType { Home, Business, Cell }. This enumeration corresponds with a lookup/dictionary table in your database like: phone_cd | phone_descr 1 ...
4
by: Marshal | last post by:
Sure... IEnumerable was inconvenient suggesting a separate class to service the enumeration, IEnumerator, and multiple operations: Current, MoveNext, Reset. (I'll warp the definition of "operation"...
1
by: Stefano G. | last post by:
I have a WSDL containing this enumeration type <xsd:simpleType name="item_type_enum"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="VCD"/> <xsd:enumeration value="SVCD"/>...
27
by: Ben Finney | last post by:
Antoon Pardon wrote: > I just downloaded your enum module for python > and played a bit with it. IMO some of the behaviour makes it less > usefull. Feedback is appreciated. I'm hoping to...
3
by: Davidoff | last post by:
Hi, I parse an XML file with a XSD schema. One XmlNode has an attribute whose type is a restriction of xs:string : <xs:simpleType name="stypeDay"> <xs:restriction base="xs:string">...
0
by: news.emn.fr | last post by:
Hello, i got this attribute <xs:attribute name="jour"> <xs:simpleType> <xs:restriction base="stypeJour"> </xs:restriction> </xs:simpleType> </xs:attribute>
3
by: eXt | last post by:
For a realtime-application (half an application at least, kind of a framework) I am working with I need a event managing system and naturally it must be fast. I have defined a set of available...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.