C
C#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
E
ero489d ago
there's nothing to remove just overwrite it but you kinda need to specify which blogpost to edit
R
Ronnie489d 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]);?
E
ero489d ago
so blogPostList[index][0] = Console.ReadLine();?
R
Ronnie489d 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
E
ero489d ago
OrderBy
R
Ronnie489d 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 Azu❔ 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❔ Is it possible to have WPF window hidden until Blazor WebView loads page?I'm trying to hide a WPF window until the Blazor WebView loads, but it seems that the initialization❔ SQLite in-memory Database read from ReadOnlyMemory bytesI'm receiving an SQLite database payload from an AMQP-0-9-1 message in the form of `ReadOnlyMemory<bSettings.Default not savingI have two integers, primary and secondary, that i want to persist, but they refuse to❔ need help opening siteshow do i make visual studio open a site and then press on a bar to type something❔ Generally, how do you implement a readonly struct?Hi. Generally, how do you implement a readonly struct? I mean define readonly fields or getter? What❔ How can I query a JSON doc for only objects with a specific property value?I have a JSON object that looks like this: ```json { "pagedata": [ { "id": "❔ Are TryAsync methods acceptable?I've just been refactoring some implementations of a method I have to go from `T Load()` to `bool Tr❔ Wpf chess board problemHello! Im trying to color a chess board. I have a bunch of border tags for the squares. I think it c❔ Errors when everything looks ok.So, I'm dumb a aspnet api, with controllers, using sqlite. There are no syntax errors in the code, s✅ How do I merge a list of dictionaries based on keys using LINQ?So if I have something like: `[{ number: 1 }, { number: 2 }, { number: 3 }]` I want to get: `{ numbeSelect Hotkey Component WinformsHow can i have a sort of "select hotkey" component that lets the user press a key and captures the K