473,394 Members | 1,724 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,394 software developers and data experts.

A Set Collection class

Does C# have a Set Collection class/functions of some sort? I can not seem
to find it.
A collection that I could extract thing like:

Get only unique entries:
{1,1,1,2,2,3,4,5,5,5,5,6,6} yields {1,2,3,4,5,6}

Get each set of unique entries:
{1,1,1,2,2,3,4,6,6} yields {{1,1,1},{2,2},{3},{4},{5,5,5,5},{6,6}}

Other set operation on a list/collection of objects.

If not what is the way most people do these types of operations. I am a
newbie, so I might need a little spoon feeding at times?

Thx
Mar 10 '07 #1
5 6207
Hello Muffin,
>Does C# have a Set Collection class/functions of some sort? I can not seem
to find it.
There is none. You can find a number of 3rd party implementations though -
search Google for "c# set" and you'll find a bunch.
Oliver Sturm
--
http://www.sturmnet.org/blog
Mar 10 '07 #2
Thx
I think I'll try and roll my ourn, I just did not want to reinvent the wheel
with a square one that goes "Thump! Thump! Thump! Thump! Bang!!" every time
I use it ;-).
"Oliver Sturm" <ol****@sturmnet.orgwrote in message
news:xn****************@msnews.microsoft.com...
Hello Muffin,
>>Does C# have a Set Collection class/functions of some sort? I can not seem
to find it.

There is none. You can find a number of 3rd party implementations though -
search Google for "c# set" and you'll find a bunch.
Oliver Sturm
--
http://www.sturmnet.org/blog

Mar 10 '07 #3
"Muffin" <mu****@NoEmail.localwrote:
>Does C# have a Set Collection class/functions of some sort? I can not seem
to find it.
What you're looking for can be found here:
http://msdn2.microsoft.com/en-us/lib...75(vs.80).aspx

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins
Mar 10 '07 #4
Hello Chris,
>What you're looking for can be found here:
http://msdn2.microsoft.com/en-us/lib...75(vs.80).aspx
Yeah, and in hundreds other places - hence my reference to a search
engine. Good article though.
Oliver Sturm
--
http://www.sturmnet.org/blog
Mar 10 '07 #5

"Chris Mullins [MVP]" <cm******@yahoo.comwrote in message
news:OK****************@TK2MSFTNGP06.phx.gbl...
"Muffin" <mu****@NoEmail.localwrote:
>>Does C# have a Set Collection class/functions of some sort? I can not seem
to find it.

What you're looking for can be found here:
http://msdn2.microsoft.com/en-us/lib...75(vs.80).aspx
Which contains:

C++, C#, Visual Basic .NET, and Java don't provide inherent language
features for working
with sets. If you want to use sets, you need to create your own set
class with the appropriate methods,
properties, and logic.

A strange thing to say, since Java has included a Set interface and a
collection of Set implementations since JDK 1.2. (Not an "inherent language
feature", but there's no need to "create your own".)

In fact, Java implements Sets on top of Maps using a straightforward pattern
that could easily be used in .NET to create a Set on top of Hashtable:

1.Create a Set class that has a field that is a Map.
2. Conceptually, define membership in the Set as being a key in the Map..
3. To add an object O to the Set, add the mapping (O, Map) to the Map.
4. To remove O from the Set, remove that mapping from the Map.
5. To check whether O is in the Set, check whether the Map contains the key
O

etc.
Mar 11 '07 #6

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

Similar topics

3
by: Marc L'Ecuyer | last post by:
Hi, I have a collection class derived from CollectionBase. This collection can add items of my class MyItem. In my class MyItem, I have a Selected property. When this property is set to true, I...
0
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a...
2
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
6
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
6
by: Erick | last post by:
I've created a class called Procs and a collection class called Processes which uses a hastable object to store the Procs. Now i want to enumerate with the "For each" to extract all the Procs in...
1
by: holysmokes99 | last post by:
I have run the VB.Net upgrade wizard to get a vb6 project up to VB.Net 1.1. This is a class library that is referenced by another VB6 app. I have exposed it to for COM access. The problem is that...
3
by: gasfusion | last post by:
Hey guys. I'm building an object collection which will be a part of a Data Access Layer i am currently working on. However, i am having some issues iterating through a collection. This is what...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.