QuickZ
QuickZ
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
Ye I guess Newtonsofts JObjects is the way to go. and later serialize it. Or automap. not sure what I get yet https://stackoverflow.com/questions/16459155/how-to-access-json-object-in-c-sharp
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
So still have to edit Dto as soon as expected ids change
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
ah never mind this API is making me f'd anyway due to response.Content.ReadAsAsync<DtoNeededHereAsWell>() Unless I try to be cleaver with the json while its serialized as string. 🤢
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
was not getting the intellisense for that one
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
been trying GetProperty()
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
ooh GetValue... forgot that last step
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
The bad idea is that the API is returning the dtos like this. But its out of my reach to change it since its 3rd party 🙂
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
Reasons: I dont want frontend to see the ids, and I dont want to manually change dtos as soon as I add something to the array, or remove.
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
because I dont want the same structure in the frontend
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
So if it was js syntax I would just access it like
var dtoToRetunToFrontend = returnedDtoFromApi[idString];
var dtoToRetunToFrontend = returnedDtoFromApi[idString];
want to do achieve same result in c# now
16 replies
CC#
Created by QuickZ on 1/8/2023 in #help
❔ Is there a way to access a prop with the help of a string.
a external app is returning props with first nested level being the ids as propnames. I have the ids in string already available. I want to be able to automatically access them. dto be looking like this for example
public class ReturnedDtoFromAPI
{
public SomeClass c7855x231323acs39a5 { get; set; }
public string ErrorMessage { get; set; }
}
public class ReturnedDtoFromAPI
{
public SomeClass c7855x231323acs39a5 { get; set; }
public string ErrorMessage { get; set; }
}
And I want to just map away from the Id so my frontend dont need to know about it but still automatically access by iterating through several of these objects. Which will be possible if I just map the level with id away. Which I will be able to if I just can access it like the question asks for
16 replies
CC#
Created by QuickZ on 10/24/2022 in #help
TestInitialize runs after constructor causing nullable warnings
And its perhaps about time to remove the server-added name on me? :>
2 replies