Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

2d list in c#

List<List<int>> list = new List<List<int>>{
         new List<int> { 1, 2, 3 },
         new List<int> { 4, 5, 6 },
         new List<int> { 9, 8, 9 }
};
Comment

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
Comment

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
Comment

c# 2d list


List<string> track = new List<string>();
track.Add("2349");
track.Add("The Prime Time of Your Life");
// etc
matrix.Add(track);

Comment

PREVIOUS NEXT
Code Example
Csharp :: serilog set log level 
Csharp :: c# restclient timeout 
Csharp :: c# string remove 
Csharp :: remove index from array c# 
Csharp :: unity random number 
Csharp :: switch case c# contains 
Csharp :: C# tolower all in a array 
Csharp :: function in c# to do addition 
Csharp :: c# switch unity 
Csharp :: c# windows forms print 
Csharp :: c# list slice 
Csharp :: c# convert string to url encoding 
Csharp :: asp.net c# set session timeout 
Csharp :: order by length descending C# 
Csharp :: switch case in c# with multiple values 
Csharp :: Unity Children Destroy 
Csharp :: optimistic update 
Csharp :: difference between alpha and beta testing 
Csharp :: {"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."} 
Csharp :: generate entity model dot net core 
Csharp :: c# string code ascii 
Csharp :: c# break from foreach method 
Csharp :: unit test c# exception thrown 
Csharp :: get x and y of mouse uinty 
Csharp :: destroy the game object if the animator has finished its animation 
Csharp :: c# for statement 
Csharp :: c# function return 
Csharp :: arcane 
Csharp :: datetime empty date 
Csharp :: c# convert dictionary object to string 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =