Click here to Skip to main content
15,847,653 members
Home / Discussions / C#
   

C#

 
GeneralRe: Arrays in C# Pin
LCI3-May-07 10:53
LCI3-May-07 10:53 
GeneralRe: Arrays in C# Pin
Jimmanuel3-May-07 11:08
Jimmanuel3-May-07 11:08 
GeneralRe: Arrays in C# Pin
Pualee3-May-07 11:36
Pualee3-May-07 11:36 
AnswerRe: Arrays in C# Pin
Guffa3-May-07 15:33
Guffa3-May-07 15:33 
GeneralRe: Arrays in C# Pin
mav.northwind3-May-07 19:47
mav.northwind3-May-07 19:47 
AnswerRe: Arrays in C# Pin
Guffa3-May-07 20:27
Guffa3-May-07 20:27 
GeneralRe: Arrays in C# Pin
mav.northwind4-May-07 9:12
mav.northwind4-May-07 9:12 
AnswerRe: Arrays in C# Pin
Guffa4-May-07 9:33
Guffa4-May-07 9:33 
mav.northwind wrote:
If you have a fixed number of columns and a variable number of rows, I think it's rather an array of lists than the other way 'round, but I guess it depends on the view...


You can do it either way, but I know which one I would use...

A list of arrays:

// creating
List<string[]> table = new List<string[]>;

// adding a line
table.Add(new string[] { "just", "adding", "another", "little", "line" } );

// getting a line
string[] line = table[0];

An array of lists:

// creating
List<string>[] table = new List<string>[4];
table[0] = new List<string>();
table[1] = new List<string>();
table[2] = new List<string>();
table[3] = new List<string>();
table[4] = new List<string>();

// adding a line
table[0].Add("just");
table[1].Add("adding");
table[2].Add("another");
table[3].Add("little");
table[4].Add("line");

// getting a line
string[] line = new string[] { table[0][0], table[1][0], table[2][0], table[3][0], table[4][0] };



---
single minded; short sighted; long gone;

AnswerRe: Arrays in C# Pin
Nouman Bhatti3-May-07 22:09
Nouman Bhatti3-May-07 22:09 
AnswerRe: Arrays in C# Pin
AFSEKI7-May-07 5:13
AFSEKI7-May-07 5:13 
QuestionPassing Parameters to a running thread Pin
Christopher Thornburg3-May-07 10:34
Christopher Thornburg3-May-07 10:34 
AnswerRe: Passing Parameters to a running thread Pin
pbraun3-May-07 12:03
pbraun3-May-07 12:03 
GeneralRe: Passing Parameters to a running thread Pin
Christopher Thornburg3-May-07 12:06
Christopher Thornburg3-May-07 12:06 
GeneralRe: Passing Parameters to a running thread Pin
pbraun3-May-07 12:14
pbraun3-May-07 12:14 
AnswerRe: Passing Parameters to a running thread Pin
Stefan Prodan3-May-07 13:01
Stefan Prodan3-May-07 13:01 
AnswerRe: Passing Parameters to a running thread Pin
AFSEKI7-May-07 5:30
AFSEKI7-May-07 5:30 
QuestionMSI Database Functions in C# Pin
CyberTech3-May-07 8:55
CyberTech3-May-07 8:55 
QuestionHow to add user to the folder? Pin
Dotnetkanna3-May-07 7:55
Dotnetkanna3-May-07 7:55 
AnswerRe: How to add user to the folder? Pin
Tarakeshwar Reddy3-May-07 8:21
professionalTarakeshwar Reddy3-May-07 8:21 
QuestionKnown issues with WebBrowser control? Pin
engsrini3-May-07 6:46
engsrini3-May-07 6:46 
AnswerRe: Known issues with WebBrowser control? Pin
PIEBALDconsult3-May-07 9:05
mvePIEBALDconsult3-May-07 9:05 
QuestionDeveloping Mobile Phone Applications using C# Pin
Nadia Monalisa3-May-07 5:46
Nadia Monalisa3-May-07 5:46 
AnswerRe: Developing Mobile Phone Applications using C# Pin
Dave Kreskowiak3-May-07 5:54
mveDave Kreskowiak3-May-07 5:54 
QuestionButton.Text has no effect? Pin
User 66583-May-07 5:37
User 66583-May-07 5:37 
AnswerRe: Button.Text has no effect? Pin
Sandeep Akhare3-May-07 5:43
Sandeep Akhare3-May-07 5:43 

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.