473,785 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

creating multiple instances of an enumerator

hi,
i need help building multiple instances of an enumerator and naming each one
filter1, filter2, filterN depending on how many the user requires, here is
the code i have so far

public enum FilterType
{
None,
ADX
MOM
}
public class System()
{
private int noOfFilters = 0;

[Category("Filte rs")]
public int NoOfFilters
{
get { return noOfFilters;}
set { noOfFilters = value;}
}

public void makeFilters(int i)
{
i = noOfFilters;
for (int j, j < i-1, j++)
{
int k = j+1;
private FilterType */do not know to name the instance filter1,
filter2 etc*/ = FilterType.None ;
}

Oct 8 '07 #1
5 2109
On Oct 8, 9:20 am, b1uceree <b1uce...@discu ssions.microsof t.com>
wrote:
i need help building multiple instances of an enumerator and naming each one
filter1, filter2, filterN depending on how many the user requires, here is
the code i have so far
I'm afraid we're going to need more information - it's not really
clear what you need to do, or what the problem is.

Also, are you using C# 2? If so, enumerators are much easier to
implement using iterator blocks.

Jon

Oct 8 '07 #2
basically just looking at the makefilters() method in each iteration i want
to be able to create a new instance of the enum "FilterType " and name it
filter1 for the first one and filter2 for the next and so on depending on the
value of noOfFilters which is user defined
i.e
public void makeFilters()
{

for ( int j=1; j < noOfFilters +1; j++ )
{
//create a new instance of the enumerator FilterType and name it
"filter plus the value of int j" eg filter2 or filter3 depending on where
we are in the iteration
}
also while on this subject is is possible to create a property for each
instance of FilterType that the method has created at the same time

"Jon Skeet [C# MVP]" wrote:
On Oct 8, 9:20 am, b1uceree <b1uce...@discu ssions.microsof t.com>
wrote:
i need help building multiple instances of an enumerator and naming each one
filter1, filter2, filterN depending on how many the user requires, here is
the code i have so far

I'm afraid we're going to need more information - it's not really
clear what you need to do, or what the problem is.

Also, are you using C# 2? If so, enumerators are much easier to
implement using iterator blocks.

Jon

Oct 8 '07 #3
On Oct 8, 11:34 am, b1uceree <b1uce...@discu ssions.microsof t.com>
wrote:
basically just looking at the makefilters() method in each iteration i want
to be able to create a new instance of the enum "FilterType " and name it
filter1 for the first one and filter2 for the next and so on depending on the
value of noOfFilters which is user defined
Hang on - you need to be very clear whether you're talking about an
*enumerator* (as per the subject) or an *enumeration* (i.e. an enum).
They're completely different things.

You then need to understand what enums are - they're not things you
create instances of, they're just fixed sets of values. You don't
create new enumerations on the fly - an enumeration is a type in
itself.

Jon

Oct 8 '07 #4
Sorry using the wrong wording completely. I do understand where i was
becoming confusing i meant that i want to declare variables as follows based
on the enumeration:

public enum FilterType
{
}

FilterType filter1 = FilterType.None
FilterType filter2 = FilterType.None
.....
FilterType filtern = FilterType.None

where n = noOfFilters


"Jon Skeet [C# MVP]" wrote:
On Oct 8, 11:34 am, b1uceree <b1uce...@discu ssions.microsof t.com>
wrote:
basically just looking at the makefilters() method in each iteration i want
to be able to create a new instance of the enum "FilterType " and name it
filter1 for the first one and filter2 for the next and so on depending on the
value of noOfFilters which is user defined

Hang on - you need to be very clear whether you're talking about an
*enumerator* (as per the subject) or an *enumeration* (i.e. an enum).
They're completely different things.

You then need to understand what enums are - they're not things you
create instances of, they're just fixed sets of values. You don't
create new enumerations on the fly - an enumeration is a type in
itself.

Jon

Oct 8 '07 #5
"b1uceree" <b1******@discu ssions.microsof t.comschrieb im Newsbeitrag
news:E5******** *************** ***********@mic rosoft.com...
Sorry using the wrong wording completely. I do understand where i was
becoming confusing i meant that i want to declare variables as follows
based
on the enumeration:

public enum FilterType
{
}

FilterType filter1 = FilterType.None
FilterType filter2 = FilterType.None
....
FilterType filtern = FilterType.None

where n = noOfFilters
Try this:

FilterType[] filters = new FilterType[n];
//Given your declaration of FiterType, the elements will allready be
FilterType.None

for (int i =0; i<n; i++)
{
fiters[i] = ....
}
Christof

Oct 8 '07 #6

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

Similar topics

1
2215
by: Martin V. | last post by:
Hello, Is the multiple instances capability of SQL2K mature enough for a Production system? We're looking at upgrading our hardware but the proposed solution calls for consolidating two currently separate SQL Server's onto one machine with two CPU's. Of the current two servers, one is for OLTP (~800Mb) and the other for
4
561
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum number of window handle, because if I reduce to about 2 instances of each window, it can run. But not 20 instances of each window. Does anyone know what the problem is? is it really because it exceeds the maximum number of window handle?
4
2404
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a hierarchy of algebraic matrices with the addition operation. Thus, I want to have a virtual base class class Matr;
11
5320
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings should configured to work, how memory is shared or not, etc. I can not seem to find any good links to this information. Thanks, Mike
12
3175
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without restarting the application. What I did was to create an AppDomain that loaded the plugins and everything was great, until I tried to pass something else that strings between the domains...
3
2603
by: Michel | last post by:
Hi, I wrote an app in .Net and I whant only 1 instance of this app open for the user; the user open my app, do some works and try to open another instance of my app, I whant to show a message to user to inform him that only one instance is permit and then close the second instance after that. I am able to do this when the user run the application on his PC whit this : Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName) ...
0
1558
by: Benjamin | last post by:
I am attempting to create multiple itterators for a custom class that I have created. Basically I have a class that I am populating using XML de-serialization. I want to be able to loop through the class using a foreach loop. I realize that in order to do this I need to create my own GetEnumerator that implements the movenext and current methods. The problem that I have is that I have been able to implement this for only one of the classes...
2
3324
by: ChrisO | last post by:
I've been pretty infatuated with JSON for some time now since "discovering" it a while back. (It's been there all along in JavaScript, but it was just never "noticed" or used by most until recently -- or maybe I should just speak for myself.) The fact that JSON is more elegant goes without saying, yet I can't seem to find a way to use JSON the way I *really* want to use it: to create objects that can be instantated into multiple...
6
5134
by: John A Grandy | last post by:
Is it possible to write a foreach so that it simultaneously iterates through two collections ( or two properties of the same collection ) ? Following is *only meant as an example* : -- iterate a dictionary obtaining the next key and value on each iteration. The following doesn't work foreach ( string key in MyDictionary.Keys , object value in
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.