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
ero2y ago
there's nothing to remove just overwrite it but you kinda need to specify which blogpost to edit
Ronnie
Ronnie2y 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
ero2y ago
so blogPostList[index][0] = Console.ReadLine();?
Ronnie
Ronnie2y 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
ero2y ago
OrderBy
Ronnie
Ronnie2y ago
thanks! 😄
Want results from more Discord servers?
Add your server
More Posts
✅ When calling a generic function, how can I tell it that I'm going to be passing null?I've got a generic function which is something like this: ```cs public ReturnType GetValue<ReturnTyp❔ WPF Textbox decimal onlyHello, i'd like to know how we are supposed to configure our textbox in order to accept only decimalmaui deserialize problemI am having a problem when trying to deserialize api data ```C# string content = await response.C❔ Log from helper class without creating new context? (Serilog)I have a bunch of services with their own dedicated loggers that have config'd settings for filterin❔ Swagger Open API not showing Request examples in the UII've written an Azure Function with Open API in C#, but when I open up the Swagger/UI to test my AzuLooking solution for get query from _dbContext.SaveChangesAsync() for save logs and easier debuggingHello, i have a .net core 6.0 app that save entites in MSSQL database with EfCORE 6.0 so my function❔ I'm building an MVC core webshop. How should I be structuring controllers, actions and views?So, right now, I have one single view, and this view renders both information about the product and ❔ How to make an object follows my mouse?so I am new at programming and trying to make a top down shooting games in windows form app. My lect❔ Is this the right way to implement an Interface```csharp interface IObstacles { void Draw(Graphics g); } class Redbox : IO❔ Is there any tool converting csv file to Class (seeding data)?I am using EF to seed data and I have an excel file containing like 500 records. If that's around 1