when i try to create 8-dimensional array i get out of bounds system
exception. does anyone know if this limitation is due to amount of memory
in my pc or a limiation of c# language?
thanks
write it to a file...
--
H.Schampheleer
hub...@haps.be
www.haps.be
I don't think that .net has such limitations.
I would say that it is a memory issue.
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
"tony collier" <mel...@hotmail.com> wrote in message
news:Xns943FF1405F...@194.117.133.134...
With the 1.1 version of the framework, you have the LongLength property,
which exposes the length in a 64 bit integer, which means you have an upper
limit of 9,223,372,036,854,775,808 elements (needless to say, a lot).
However, what you are running into, like Miha said, is probably because
of a memory constraint. To the original poster, do you really need to have
that many elements in the array? What are you trying to do? Depending on
the type of your elements, the memory alone for such an array could be
restrictive in terms of performance.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Miha Markic" <miha at rthand com> wrote in message
news:%23Vc6TzA...@TK2MSFTNGP10.phx.gbl...
Willy.
"Nicholas Paldino [.NET/C# MVP]" <m...@spam.guard.caspershouse.com> wrote in
message news:etGYjZCu...@tk2msftngp13.phx.gbl...
Yes, I am waiting for 128bit procesor so that I can put enough memory into
my computer ;-)
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
This looks like a situation where some good data structures-type design work
could really pay off. If you care to share more details, I'll provide more
comments.
If you do move forward with the 7 dimen array, and if you are using it in
code you plan to keep, put a lot of thought into making it OO and
maintainable. If the array is as dynamic as ours, someone coming along after
you won't be able to figure the code out unless it is very nicely designed.
I wouldn't manipulate a 7 dimensional array directly in other code -- put it
behind properties or methods.
BTW, you can have 2 billion elements in each dimension.
"tony collier" <mel...@hotmail.com> wrote in message
news:Xns943FF1405F...@194.117.133.134...
This is what i am trying to
do and there is probably a much better way which this newbie hasn't read
or thought about yet.
i am getting prices from x number of suppliers who all quote me a
different individual price for each of y items. no one supplier is always
cheaper than the others.
no. of suppliers: x (preferably unlimited)
no. of items: y (again, preferably unlimited)
i then calculate all the different combination of items from mixed
suppliers. The formula to work out number of combinations =
no.of supplier ^ (to the power of) no. of items.
this requires creating an array of y dimensions with x elements per
dimension to store all combinations
as you will now understand , i have so far only been able to go up to x=
11, and y=7 before running into memory constraints.
items must be able to be added/deleted like in a cart until user
checksout, so no running calculation can take place to try and crunch
numbers as i go. this is why i can't see how array can be made any
smaller.
hope this all makes sense. any ideas to do this in a better way would be
greatly appreciated.
Incidentally, is there any way to initalize all elements in the array to
zero in one fell swoop rather than looping through them? Someone has
mentioned .system.array.clear - does this work on uninitialized elements?
someone else said that this was a feature not carried over from c++.
Also, someone asked about some suppliers not having all items. So far i
have covered this with another y=7,x=11 array where elements get flagged
for any corresponding combination element that is zero.
A database was mentioned although i know very very little about ado.net
and sql so this would be a real chore for me to do it this way - surely
reading and writing would be too slow for so many entries anyway?
regards TC.
> A database was mentioned although i know very very little about
> ado.net and sql so this would be a real chore for me to do it this
> way - surely reading and writing would be too slow for so many
> entries anyway?
There's two ways to solve a problem: the fast way and the right way. If
you want to code an application that will not require any code
maintenance when the number of suppliers and/or items change, ADO.NET is
the way to go.
--
There are 10 kinds of people. Those who understand binary and those who
don't.
http://code.acadx.com
(Pull the pin to reply)