Re: C# Question
- From: "Ricks Place" <OFBGMail@xxxxxxxxx>
- To: <programmingblind@xxxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 16:34:25 -0400
Here is an article about array list using objects.
You might create a list of the class or an object containing one unique
entry for each row/col combo.
http://authors.aspalliance.com/remas/ASP.NET/VFAQNET/DynamicArrays/
Look for the dynamic array article.
Rick USA
----- Original Message -----
From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, March 30, 2008 4:21 PM
Subject: RE: C# Question
Then you'd do an ArrayList of ArrayLists
Or honestly, you make a collection, yourself, which is easy to do in C#
since you can overload the [] operator.
Take care,
Sina
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ricks Place
Sent: Sunday, March 30, 2008 4:15 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: C# Question
I'm back for a second, an Arraylist is only one dimensional if I remember.
I'll do a little googling on another computer while I do some background
work on this one and see if I can find something. You want to put what
exactly into your array?
Are you trying to store indexed elemental datatypes or are you wanting to
store objects? Are you trying to store instances of the class itself?
Rick USA
----- Original Message -----
From: "Chris Hofstader" <chris.hofstader@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, March 30, 2008 3:15 PM
Subject: RE: C# Question
Thanks Rick,
Sina had most of the answer and I just found an article online on some
programming site that told me to use an ArrayList instead of an Array
and all of my problems should be solved. I haven't looked at the
documentation on ArrayList yet and haven't given it a try yet.
cdh
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ricks
Place
Sent: Sunday, March 30, 2008 3:09 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: C# Question
I'm not sure about auto sizing arrays. I thought they would resize too
but not worked in C# in 3 or so years. If you know the max size and
it's not huge you could just set the max size in each dimension for
initial testing to make sure everything else is working like the
instantiation. I have to do
some things but will be back in awhile and see if I can dig something up.
I
have never assigned class objects, just int and strings to arrays in
the old
days but I don't see why objects would be diferent.
Also, it seems i remember the c# syntax using the variable type in the
first
position of a definition.
int MyArray[][]; Or something like that.
Sorry I can't dig into it right now but look for an array definition
using an object Data type.
I'll be back later today to help if I can.
Sina may have had the answer, over my head but he is really advanced.
Rick USA
----- Original Message -----
From: "Chris Hofstader" <chris.hofstader@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, March 30, 2008 2:59 PM
Subject: RE: C# Question
This is my first venture into multidimensional C# arrays. Prior to
Sina's message I thought they grew as needed but that seems to have
been a false assumption. I've been digging through documentation and
learned that my initial declaration was indeed wrong. The
"dataTable" in my example isn't from my code and was only meant to
act as an illustration.
So, if arrays do not resize dynamically, how can I start with a table
of unknown number of rows and columns and store them in an array?
Thanks,
cdh
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ricks
Place
Sent: Sunday, March 30, 2008 2:53 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: C# Question
Hi Chris:
How adept are you with C# Arrays? I ask because the format of the
definition
just looks wierd somehow, not looked at C# in a long time. Also,
dataTable might be treading on the DataTable keyword or the array was
not instantiated.
If you are adept at using C# arrays I'll guess it is something I've
just not encountered, assigning objects in an array. Otherwise I'll
dig into the docs for Arrays and see if I can find anything.
Rick USA
----- Original Message -----
From: "Chris Hofstader" <chris.hofstader@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, March 30, 2008 2:26 PM
Subject: C# Question
Hi,
I have a class which, for purposes of illustration, I'll call MyClass.
I
want to declare a two dimensional array of this class so I can have
a set of rows and columns within. I don't know the ultimate size of
the array so I declare it with empty brackets.
For instance:
MyArray[][] dataTable; // This compiles without error
but, in the code, if I state:
dataTable[0][0] = new MyClass();
I get an exception about a NULL assignment when the code is executed.
I had thought that .Net arrays declared without the "fixed" keyword
would grow dynamically and that the Array type overloaded the
brackets to ensure the sort of exception I'm getting doesn't happen.
Obviously, I'm doing something quite wrong but I'm having trouble
finding examples of C# arrays of anything more complex than int or
String.
Please help.
Thanks,
cdh
Chris Hofstader
CUNY, BSO, ATG, Odds and Ends
email: cdh@xxxxxxxxxxxxx
Blog: http://www.blindconfidential.blogspot.com
Skype: BlindChristian
phone: 727-896-6393
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________ NOD32 2984 (20080329) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________ NOD32 2984 (20080329) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
- References:
- Programming is hard, let's go scripting
- From: Octavian Rasnita
- Re: Larry Wall Talks, Perl and Lua (Was: Programming is hard, let's go scripting)
- From: Veli-Pekka Tätilä
- Re: Larry Wall Talks, Perl and Lua (Was: Programming is hard, let's go scripting)
- From: Octavian Rasnita
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Veli-Pekka Tätilä
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Octavian Rasnita
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Veli-Pekka Tätilä
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Octavian Rasnita
- C# Question
- From: Chris Hofstader
- Re: C# Question
- From: Ricks Place
- RE: C# Question
- From: Chris Hofstader
- Re: C# Question
- From: Ricks Place
- RE: C# Question
- From: Chris Hofstader
- Re: C# Question
- From: Ricks Place
- RE: C# Question
- From: Sina Bahram
Other related posts:
- » C# Question
- » RE: C# Question
- » Re: C# Question
- » Re: C# Question
- » RE: C# Question
- » Re: C# Question
- » RE: C# Question
- » RE: C# Question
- » RE: C# Question
- » Re: C# Question
- » RE: C# Question
- » Re: C# Question
- » RE: C# Question
- » RE: C# Question
- » Re: C# Question
- » C# Question - Marvin Hunkin
Then you'd do an ArrayList of ArrayLists Or honestly, you make a collection, yourself, which is easy to do in C# since you can overload the [] operator. Take care, Sina -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ricks Place Sent: Sunday, March 30, 2008 4:15 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: C# Question I'm back for a second, an Arraylist is only one dimensional if I remember. I'll do a little googling on another computer while I do some background work on this one and see if I can find something. You want to put what exactly into your array? Are you trying to store indexed elemental datatypes or are you wanting to store objects? Are you trying to store instances of the class itself? Rick USA ----- Original Message ----- From: "Chris Hofstader" <chris.hofstader@xxxxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Sunday, March 30, 2008 3:15 PM Subject: RE: C# Question
Thanks Rick, Sina had most of the answer and I just found an article online on some programming site that told me to use an ArrayList instead of an Array and all of my problems should be solved. I haven't looked at the documentation on ArrayList yet and haven't given it a try yet. cdh -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ricks Place Sent: Sunday, March 30, 2008 3:09 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: C# Question I'm not sure about auto sizing arrays. I thought they would resize too but not worked in C# in 3 or so years. If you know the max size and it's not huge you could just set the max size in each dimension for initial testing to make sure everything else is working like the instantiation. I have to do some things but will be back in awhile and see if I can dig something up. I have never assigned class objects, just int and strings to arrays in the old days but I don't see why objects would be diferent. Also, it seems i remember the c# syntax using the variable type in the first position of a definition. int MyArray[][]; Or something like that. Sorry I can't dig into it right now but look for an array definition using an object Data type. I'll be back later today to help if I can. Sina may have had the answer, over my head but he is really advanced. Rick USA ----- Original Message ----- From: "Chris Hofstader" <chris.hofstader@xxxxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Sunday, March 30, 2008 2:59 PM Subject: RE: C# QuestionThis is my first venture into multidimensional C# arrays. Prior to Sina's message I thought they grew as needed but that seems to have been a false assumption. I've been digging through documentation and learned that my initial declaration was indeed wrong. The "dataTable" in my example isn't from my code and was only meant to act as an illustration. So, if arrays do not resize dynamically, how can I start with a table of unknown number of rows and columns and store them in an array? Thanks, cdh -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ricks Place Sent: Sunday, March 30, 2008 2:53 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: C# Question Hi Chris: How adept are you with C# Arrays? I ask because the format of the definition just looks wierd somehow, not looked at C# in a long time. Also, dataTable might be treading on the DataTable keyword or the array was not instantiated. If you are adept at using C# arrays I'll guess it is something I've just not encountered, assigning objects in an array. Otherwise I'll dig into the docs for Arrays and see if I can find anything. Rick USA ----- Original Message ----- From: "Chris Hofstader" <chris.hofstader@xxxxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Sunday, March 30, 2008 2:26 PM Subject: C# QuestionHi, I have a class which, for purposes of illustration, I'll call MyClass. I want to declare a two dimensional array of this class so I can have a set of rows and columns within. I don't know the ultimate size of the array so I declare it with empty brackets. For instance: MyArray[][] dataTable; // This compiles without error but, in the code, if I state: dataTable[0][0] = new MyClass(); I get an exception about a NULL assignment when the code is executed. I had thought that .Net arrays declared without the "fixed" keyword would grow dynamically and that the Array type overloaded the brackets to ensure the sort of exception I'm getting doesn't happen. Obviously, I'm doing something quite wrong but I'm having trouble finding examples of C# arrays of anything more complex than int or String. Please help. Thanks, cdh Chris Hofstader CUNY, BSO, ATG, Odds and Ends email: cdh@xxxxxxxxxxxxx Blog: http://www.blindconfidential.blogspot.com Skype: BlindChristian phone: 727-896-6393 __________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind__________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind __________ NOD32 2984 (20080329) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com __________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind__________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind __________ NOD32 2984 (20080329) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com __________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind
__________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind __________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind
- Programming is hard, let's go scripting
- From: Octavian Rasnita
- Re: Larry Wall Talks, Perl and Lua (Was: Programming is hard, let's go scripting)
- From: Veli-Pekka Tätilä
- Re: Larry Wall Talks, Perl and Lua (Was: Programming is hard, let's go scripting)
- From: Octavian Rasnita
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Veli-Pekka Tätilä
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Octavian Rasnita
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Veli-Pekka Tätilä
- Re: Perl Pros and Cons: Syntax and Modules (Was: Larry Wall Talks, Perl and Lua)
- From: Octavian Rasnita
- C# Question
- From: Chris Hofstader
- Re: C# Question
- From: Ricks Place
- RE: C# Question
- From: Chris Hofstader
- Re: C# Question
- From: Ricks Place
- RE: C# Question
- From: Chris Hofstader
- Re: C# Question
- From: Ricks Place
- RE: C# Question
- From: Sina Bahram