❔ Refactoring a Tag class
I have a
Tag
class that has the ability to store information about tags. Each tag has several properties associated with it. For example:
I am trying to think of a more efficient way to handle this. At the moment, each tag is stored in a json file and then loaded on startup. Therefore, I am accessing each tag with a string, and getting each property based on this file.
It works, but I think it could be better. I'm running into issues of bringing stuff back into memory with this setup. Any suggestions are welcome, thanks.18 Replies
Ero#1111
REPL Result: Success
Console Output
Compile: 755.865ms | Execution: 95.777ms | React with ❌ to remove this embed.
don't see the problem
and if you desperately need to keep the names; https://discord.com/channels/143867839282020352/598678594750775301/1042032291871998093
thinker227#5176
Try
[property: JsonPropertyName("bar")]
Quoted by
<@!542772576905199626> from #roslyn (click here)
React with ❌ to remove this embed.
so like this i guess
Well I preferably want to pull all of this out of json
But I guess if it's not needed, then I won't
mh, how do you mean?
I was thinking that I could have classes for each property, but I also thought that would be a ton of code
you really shouldn't care about how much code something takes
But I also wanted to group them together
In the same list
if it's better perf, better ux, then that's way more important than "how much code it takes"
your question isn't really clear
you asked for "a better way to handle this"
what's "this"?
Making an object, that has a type name, other props, etc.
And storing it in a list
I wasn't sure if there was a better way to accomplish that
does this list need to persist between app restarts?
It does not
so why not just a
List<Tag>
?That's what I have now, I'm assuming what I'm trying to do here is fine. I was just worried that I was creating a mess for anyone after me.
Because I have to go through and do stuff like this
For each one
instead of what?
looks perfectly fine to me
Not sure actually
Just looks like a lot when I have 50+ lines of that
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.