Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
QuestionHow to get array data in correct sequence from serial port in C# Pin
DredgPost10-Jan-15 9:52
DredgPost10-Jan-15 9:52 
SuggestionRe: How to get array data in correct sequence from serial port in C# Pin
Richard MacCutchan10-Jan-15 21:40
mveRichard MacCutchan10-Jan-15 21:40 
GeneralRe: How to get array data in correct sequence from serial port in C# Pin
DredgPost11-Jan-15 1:48
DredgPost11-Jan-15 1:48 
AnswerRe: How to get array data in correct sequence from serial port in C# Pin
OriginalGriff10-Jan-15 22:39
mveOriginalGriff10-Jan-15 22:39 
GeneralRe: How to get array data in correct sequence from serial port in C# Pin
DredgPost11-Jan-15 11:39
DredgPost11-Jan-15 11:39 
Generalspeack to text Pin
Mạnh Tuyên9-Jan-15 17:27
Mạnh Tuyên9-Jan-15 17:27 
GeneralRe: speack to text Pin
OriginalGriff9-Jan-15 21:30
mveOriginalGriff9-Jan-15 21:30 
GeneralRe: speack to text Pin
Pete O'Hanlon10-Jan-15 2:44
mvePete O'Hanlon10-Jan-15 2:44 
AnswerRe: speack to text Pin
Afzaal Ahmad Zeeshan10-Jan-15 9:26
professionalAfzaal Ahmad Zeeshan10-Jan-15 9:26 
QuestionMultiline textbox scrollbars cannot be moved Pin
robwm19-Jan-15 13:00
robwm19-Jan-15 13:00 
AnswerRe: Multiline textbox scrollbars cannot be moved Pin
Eddy Vluggen9-Jan-15 22:04
professionalEddy Vluggen9-Jan-15 22:04 
GeneralRe: Multiline textbox scrollbars cannot be moved Pin
robwm112-Jan-15 7:39
robwm112-Jan-15 7:39 
GeneralRe: Multiline textbox scrollbars cannot be moved Pin
Eddy Vluggen12-Jan-15 7:56
professionalEddy Vluggen12-Jan-15 7:56 
GeneralRe: Multiline textbox scrollbars cannot be moved Pin
robwm112-Jan-15 7:59
robwm112-Jan-15 7:59 
GeneralRe: Multiline textbox scrollbars cannot be moved Pin
Eddy Vluggen12-Jan-15 10:14
professionalEddy Vluggen12-Jan-15 10:14 
GeneralRe: Multiline textbox scrollbars cannot be moved Pin
robwm112-Jan-15 10:28
robwm112-Jan-15 10:28 
Question3 Dimensional Array C# Pin
Member 113642179-Jan-15 10:35
Member 113642179-Jan-15 10:35 
AnswerRe: 3 Dimensional Array C# Pin
PIEBALDconsult9-Jan-15 10:51
mvePIEBALDconsult9-Jan-15 10:51 
GeneralRe: 3 Dimensional Array C# Pin
Member 1136421710-Jan-15 7:08
Member 1136421710-Jan-15 7:08 
AnswerRe: 3 Dimensional Array C# Pin
Eddy Vluggen9-Jan-15 12:37
professionalEddy Vluggen9-Jan-15 12:37 
GeneralRe: 3 Dimensional Array C# Pin
Member 1136421710-Jan-15 6:51
Member 1136421710-Jan-15 6:51 
AnswerRe: 3 Dimensional Array C# Pin
BillWoodruff9-Jan-15 14:05
professionalBillWoodruff9-Jan-15 14:05 
GeneralRe: 3 Dimensional Array C# Pin
Member 1136421710-Jan-15 6:41
Member 1136421710-Jan-15 6:41 
GeneralRe: 3 Dimensional Array C# Pin
BillWoodruff10-Jan-15 8:19
professionalBillWoodruff10-Jan-15 8:19 
In C#, for all practical purposes, it is legitimate to consider the value returned by 'GetUpperBound to be the same as the value returned by GetLength. Normally in C#: Array.GetLowerBound(#n) will return zero.

It is possible, though unusual, to have Arrays in C# whose lower bounds are not zero; for example: you might inter-operate with Excel and get an Array whose indexes are one-based. Or you can create such strange arrays by using the Array.CreateInstance(Type, Int32[], Int32[]) overload of Array.CreateInstance.

Here's a one-based array of string of length #5:
C#
Array oneBasedArray =  Array.CreateInstance(typeof(string), new int[] { 5 }, new int[] { 1 });

// force an error of type: An unhandled exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll

// oneBasedArray.SetValue("wtf",0)

// this is okay ...
oneBasedArray.SetValue("hello", 1);
And:
C#
> ? oneBasedArray.GetUpperBound(0)

// examine in Command Window:
5
> ? oneBasedArray.GetLength(0)
5
> ? oneBasedArray.GetLowerBound(0)
1
I suggest you engage with non-zero based Arrays as you need to in the course of inter-op with COM, or whatever.
«A man will be imprisoned in a room with a door that's unlocked and opens inwards ... as long as it does not occur to him to pull rather than push»  Wittgenstein

GeneralRe: 3 Dimensional Array C# Pin
Member 1136421711-Jan-15 16:10
Member 1136421711-Jan-15 16:10 

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.