473,503 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# Indexer Wizard?

Im trying to now manipulate arrays in C#

Point[] points = new Point[200];



for (int x = 0; x < 200; x++)

{

points[x] = { (20 + x) , ( += null) }; //any variation of brackets and commas fails.

}

Im trying to draw using Graphics DrawLines, which takes coordinates to draw a line from last to next, etc

Then trying to fill up an array of the 200 points with specific data. The use here is Point(int x1, int y1)

The format of the array of points is x1 = an offset of 20 added to the running value of the "x" in the for loop, and then y1 can be any value between 0 and 200.

Just trying to initialize the array to anything? has proven difficult, the array control doesnt seem as powerful as C

Then in a C# book, it says use the C# Indexer Wizard, simply right click on the class where your array is, and it gives you a wizard to construct what youre trying to do. But the one Im using has nothing like that...

Is this a common tool? Indexer Wizard? Or how are arrays managed in C# thats so different?

thanks

Nov 16 '05 #1
3 1114
Bradley1234 wrote:
Im trying to now manipulate arrays in C#
*Point[] points = new Point[200];*

* *

* for (int x = 0; x < 200; x++)*

* {*

* points[x] = { (20 + x) , ( += null) }; //any variation of
brackets and commas fails.*

*}*

**

points[x] = new Point(yourXValue, yourYValue)
Nov 16 '05 #2


points[x] = new Point(yourXValue, yourYValue)


Wow, thanks it works! Now the code is

for (int x = 0; x < 200; x++)

{
points[x] = new Point((x += 0), (x += 030));
}

e.Graphics.DrawLines(pen, points);

Im so grateful for the assistance, and I just figured out how to leave one or the other part of the x.y in its place by just a reference

points[x] = new Point((x += 0), (points[x].Y));

cool.

And an odd side effect is that it draws 7 lines, starting at point 0,0 it makes a line straight down 15, the next one from 00 goes at an angle and stops at 30,15 then the next from 00 goes at more of an angle to 45,30 then 00 to 60,45 and so on until its made 7 lines. If you change the amount added to x it makes different angles, 0 and 0 makes a single line

I just want some way to take some series of ints or int32 to make the Y component. It will be taking streams or blocks of various points of some set length

Nov 16 '05 #3
okay, I thought x+= was the way C# used what C calls x+. Im not trying to modify x again, but probably was.
"Bradley1234" <so*****@yahoo.com> wrote in message news:HgNxd.2366$_62.1869@trnddc01...


points[x] = new Point(yourXValue, yourYValue)


Wow, thanks it works! Now the code is

for (int x = 0; x < 200; x++)

{
points[x] = new Point((x += 0), (x += 030));
}

e.Graphics.DrawLines(pen, points);

Nov 16 '05 #4

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

Similar topics

14
8340
by: Nikhil Patel | last post by:
Hi all, Is it possible to have more than one indexer in a class. If not, are there any good alternative ways to achieve similar functionality. Thanks... -Nikhil
16
1973
by: Yoramo | last post by:
Hello I have a class the containes several ArrayList's and I whold like to use a indexer for each one. I'm getting a compilation error. "already defines a member called 'this' with the same...
7
485
by: Oren | last post by:
hi I have created a class with a simple indexer what is the syntax for adding the function "Remove" ... myClass.colors=Color.Black; // WORKS O myClass.colors.Remove(); // ?? .......
7
4607
by: Steph | last post by:
I'm learning C#. I need to implement an indexer using an array list. I have the following code and I'm getting an error "Inconsistent accessibility: indexer return type CRegs is less accessible...
5
2281
by: Clive Dixon | last post by:
Is it possible to access an indexer of a base class with identical signature, e.g. class Class1 { public object this { get { // ...
8
7489
by: Bill Cohagan | last post by:
I'm curious as to why C# doesn't support static indexers. Anybody know? Thanks, Bill
3
1469
by: Nash Alexx | last post by:
Hello! I am quite new to C#, and one concept that really gives me a headache is "indexer". I have gone through the MSDN examples, and, at some level know how to use indexers. But, the thing is I...
17
2057
by: SemSem | last post by:
i want to know waht is an index and how we use it with a simple example including the main of the program . thanx -- Islam Khalil,
3
1238
by: Duggi | last post by:
Hello, I have a class with an indexer in the class. The code code is in C#. However I was trying to access the indexer in the other lang of .Net, VB. I ran into some indexer related issues (I...
0
7193
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
7264
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
5562
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,...
1
4992
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
3160
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...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
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 ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
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...

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.