Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
QuestionUSB Reader Pin
S.Aijaz14-Jun-10 3:44
S.Aijaz14-Jun-10 3:44 
Answercross-post Pin
Luc Pattyn14-Jun-10 3:55
sitebuilderLuc Pattyn14-Jun-10 3:55 
QuestionDemo Deployment Pin
eraser95014-Jun-10 3:17
eraser95014-Jun-10 3:17 
AnswerRe: Demo Deployment Pin
Johnny J.14-Jun-10 3:36
professionalJohnny J.14-Jun-10 3:36 
AnswerRe: Demo Deployment Pin
kasraa0009800014-Jun-10 4:34
kasraa0009800014-Jun-10 4:34 
QuestionClass methods for accessing/modifying multiple array variables Pin
BenBJT14-Jun-10 2:59
BenBJT14-Jun-10 2:59 
AnswerRe: Class methods for accessing/modifying multiple array variables Pin
Łukasz Nowakowski14-Jun-10 3:15
Łukasz Nowakowski14-Jun-10 3:15 
AnswerRe: Class methods for accessing/modifying multiple array variables Pin
Luc Pattyn14-Jun-10 3:26
sitebuilderLuc Pattyn14-Jun-10 3:26 
Rather than having several arrays running in parallel, you could create a single array holding instances of a new class or struct. Example:

public class Channel {
        public Boolean ChLog;
        public String Label;
        public int CallibrationUnit;
}

public class Test {
        private Channel[] channels=new Channel[12];
}


The choice between class and struct is yours; for bigger objects, I would favor class, and also when references come in handy, as in what follows.

Finally, rather than setting an upper limit for the number of channels you can handle, it is often better to use a collection, as in:

public class Test {
        private List<Channel> channels=new List<Channel>();

...
        channels.Add(new Channel(true, "aha", 3)); // needs a constructor!
        Console.WriteLine(channels[3].ToString()); // needs a ToString definition
...
}


One advantage of generic lists is they don't need a dimension, as they can grow dynamically.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

Nil Volentibus Arduum

modified on Monday, June 14, 2010 9:46 AM

Questionhow i know when user created Pin
noamtzu0014-Jun-10 2:47
noamtzu0014-Jun-10 2:47 
AnswerRe: how i know when user created Pin
Pete O'Hanlon14-Jun-10 3:36
mvePete O'Hanlon14-Jun-10 3:36 
GeneralRe: how i know when user created Pin
noamtzu0014-Jun-10 18:33
noamtzu0014-Jun-10 18:33 
QuestionGetting a column or parameter's data type from the database [modified] Pin
JohnLBevan14-Jun-10 1:42
professionalJohnLBevan14-Jun-10 1:42 
AnswerRe: Getting a column or parameter's data type from the database Pin
PIEBALDconsult14-Jun-10 2:44
mvePIEBALDconsult14-Jun-10 2:44 
GeneralRe: Getting a column or parameter's data type from the database Pin
JohnLBevan14-Jun-10 8:40
professionalJohnLBevan14-Jun-10 8:40 
GeneralRe: Getting a column or parameter's data type from the database Pin
PIEBALDconsult14-Jun-10 13:48
mvePIEBALDconsult14-Jun-10 13:48 
QuestionA few questions Pin
SRJ9214-Jun-10 1:12
SRJ9214-Jun-10 1:12 
AnswerRe: A few questions Pin
Eddy Vluggen14-Jun-10 2:08
professionalEddy Vluggen14-Jun-10 2:08 
GeneralRe: A few questions Pin
SRJ9214-Jun-10 10:08
SRJ9214-Jun-10 10:08 
GeneralRe: A few questions Pin
Eddy Vluggen14-Jun-10 10:38
professionalEddy Vluggen14-Jun-10 10:38 
QuestionLogin dialog on page loads Pin
Ramkithepower14-Jun-10 0:39
Ramkithepower14-Jun-10 0:39 
AnswerWrong forum - Try the ASP.NET forum. Pin
Pete O'Hanlon14-Jun-10 0:42
mvePete O'Hanlon14-Jun-10 0:42 
AnswerRe: Login dialog on page loads Pin
OriginalGriff14-Jun-10 0:43
mveOriginalGriff14-Jun-10 0:43 
AnswerRe: Login dialog on page loads Pin
Ramkithepower14-Jun-10 22:21
Ramkithepower14-Jun-10 22:21 
QuestionScalable Email service Pin
nitin_ion14-Jun-10 0:28
nitin_ion14-Jun-10 0:28 
AnswerRe: Scalable Email service Pin
OriginalGriff14-Jun-10 0:45
mveOriginalGriff14-Jun-10 0:45 

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.