Click here to Skip to main content
15,917,174 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to IF?! Pin
harold aptroot10-Apr-10 14:48
harold aptroot10-Apr-10 14:48 
GeneralRe: how to IF?! Pin
AspDotNetDev10-Apr-10 15:02
protectorAspDotNetDev10-Apr-10 15:02 
GeneralRe: how to IF?! Pin
harold aptroot10-Apr-10 15:18
harold aptroot10-Apr-10 15:18 
GeneralRe: how to IF?! Pin
NavnathKale10-Apr-10 20:18
NavnathKale10-Apr-10 20:18 
GeneralRe: how to IF?! Pin
harold aptroot11-Apr-10 2:25
harold aptroot11-Apr-10 2:25 
QuestionSerialization problem Pin
Alan Balkany9-Apr-10 10:57
Alan Balkany9-Apr-10 10:57 
AnswerRe: Serialization problem Pin
Migounette9-Apr-10 11:13
Migounette9-Apr-10 11:13 
GeneralRe: Serialization problem Pin
Alan Balkany9-Apr-10 11:17
Alan Balkany9-Apr-10 11:17 
GeneralRe: Serialization problem Pin
Alan Balkany9-Apr-10 11:38
Alan Balkany9-Apr-10 11:38 
GeneralRe: Serialization problem Pin
Migounette9-Apr-10 11:55
Migounette9-Apr-10 11:55 
AnswerRe: Serialization problem Pin
Luc Pattyn9-Apr-10 11:23
sitebuilderLuc Pattyn9-Apr-10 11:23 
GeneralRe: Serialization problem Pin
Alan Balkany9-Apr-10 11:29
Alan Balkany9-Apr-10 11:29 
QuestionDont understand arrays Pin
netJP12L9-Apr-10 10:44
netJP12L9-Apr-10 10:44 
AnswerRe: Dont understand arrays Pin
Migounette9-Apr-10 11:25
Migounette9-Apr-10 11:25 
AnswerRe: Dont understand arrays Pin
Sir Dot Net9-Apr-10 11:26
Sir Dot Net9-Apr-10 11:26 
Every array has at least 1 dimension, for instance:
string[] x1 = new string[] {...} // is 1 dimensional
string[,] x2 = new string[,] {...} // is 2 dimensional
string[,,] x3 = new string[,,] {...} //is 3 dimensional

Each dimension has upper and lower bounds, which in most cases is easiest to think about as a capacity, since the lower bound is almost always 0.

The GetUpper and LowerBounds functions help you get the bounds (lowest possible index to highest possible index) for the given dimension, so...

Here we are creating a 1 dimentional array with a capacity of 5 elements.
string[] x1 = new string[5];

now we pass the target dimension (0 index based) to the function...
GetLowerBounds(0) would say 0.
GetUpperBounds(0) would say 4.

Why does upper bounds say 4? Because the bounds functions are returning 0 based indexes, thus, the capacity is 5, and the 5 indexes of each 'space' are 0,1,2,3, and 4.

If we were to do this:
GetLowerBounds(1) or GetUpperBounds(1) we would get an exception, because our array has only 1 dimension (thus we would pass index 0).

More reading here:
http://msdn.microsoft.com/en-us/library/system.array.getlowerbound.aspx[^]
http://www.java2s.com/Tutorial/CSharp/0220__Data-Structure/ArrayGetLowerBoundGetUpperBound.htm[^]
AnswerRe: Dont understand arrays Pin
AspDotNetDev9-Apr-10 11:35
protectorAspDotNetDev9-Apr-10 11:35 
GeneralRe: Dont understand arrays Pin
Luc Pattyn9-Apr-10 12:24
sitebuilderLuc Pattyn9-Apr-10 12:24 
GeneralRe: Dont understand arrays Pin
AspDotNetDev9-Apr-10 16:12
protectorAspDotNetDev9-Apr-10 16:12 
Questionownerdrawn treenodes Pin
xilefxilef9-Apr-10 10:32
xilefxilef9-Apr-10 10:32 
AnswerRe: ownerdrawn treenodes Pin
NavnathKale9-Apr-10 11:10
NavnathKale9-Apr-10 11:10 
AnswerRe: ownerdrawn treenodes Pin
Migounette9-Apr-10 12:28
Migounette9-Apr-10 12:28 
GeneralRe: ownerdrawn treenodes Pin
xilefxilef9-Apr-10 13:59
xilefxilef9-Apr-10 13:59 
GeneralRe: ownerdrawn treenodes Pin
DaveyM6910-Apr-10 4:59
professionalDaveyM6910-Apr-10 4:59 
Questiondisabling text selection and cursor blinking in textbox Pin
teknolog1239-Apr-10 8:47
teknolog1239-Apr-10 8:47 
AnswerRe: disabling text selection and cursor blinking in textbox Pin
Dave Kreskowiak9-Apr-10 8:51
mveDave Kreskowiak9-Apr-10 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.