Horje
2d list c# Code Example
c# 2d list
//This code is an updated, working version of the code Tender Termite wrote

List<List<int>> matrix = new List<List<int>>();  //Create 2d List
List<int> list1 = new List<int>();
list1.Add(4);
list1.Add(5);
matrix.Add(list1);	//Insert List into matrix
List<int> list2 = new List<int>();
list2.Add(6);
list2.Add(7);
matrix.Add(list2);

int x = matrix[0][1];	//Get data from Matrix, here x is 5

matrix[0].RemoveAt(1);  //Removes the 5
x = matrix[0][0];		//x is now 4

matrix.RemoveAt(0);		//removes whole first row

x = matrix[0][1];		//x is now 7
2d list c#
List<List<int>> matrix = new List<List<int>>();
List<int> list1 = new List<int>();
list1.Add("4");
list1.Add("5");
matrix.Add(list1);
List<int> list2 = new List<int>();
list2.Add("6");
list2.Add("7");
matrix.Add(list2);

//matrix is now
// 4 5
// 6 7




Csharp

Related
c# get application root path directory Code Example c# get application root path directory Code Example
length of a string c# Code Example length of a string c# Code Example
how to remove white spaces from string in c# Code Example how to remove white spaces from string in c# Code Example
instantiate a player in photon Code Example instantiate a player in photon Code Example
.net Core Return File like File Server Code Example .net Core Return File like File Server Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9