C
C#•2y ago
Ronnie

Remove or overwrite single element of list of arrays

(not completely sure its called list of arrays) Basically i have one of these: List<string[]> blogPostList = new(); each post in the list has three elements like this: string[] blogPost = new string[3]; If you look at the picture, I am trying to let the user "overwrite" the title, by first removing it with removeAt (and then just add new with blogPostList.Add(blogPost[index][0]);) but I cant find anywhere how to write the code for the removeAt? since i want to overwrite just index 0, and not all 3 index of the blogPost
6 Replies
ero
ero•2y ago
there's nothing to remove just overwrite it but you kinda need to specify which blogpost to edit
Ronnie
RonnieOP•2y ago
the index should be the specified blogpost, and then element 0 of the specified blogpost is there a method to ooverwrite directly or do i just do blogPostList.Add(blogPost[index][0]);?
ero
ero•2y ago
so blogPostList[index][0] = Console.ReadLine();?
Ronnie
RonnieOP•2y ago
haha.. so it was as simple as that :p also, one more question! When I show the list top to bottom, i first want to sort it by date that is saved in index 2 on all blog posts, what type of function can be used? I dont know what to google
ero
ero•2y ago
OrderBy
Ronnie
RonnieOP•2y ago
thanks! 😄
Want results from more Discord servers?
Add your server