C
C#11mo ago
Dawnbomb

❔ Spreadsheet option for a dict / class? (visual studio)

I finally set a bunch of stuff up and their working correctly, huzah! Now, i have a dictionary that has a bunch of instances of the same class, and that class has a few variables. However, the number of instances of that class is going to be...very large. It can forsee it going over 150, and i need to set each variable for each copy of the class in that dictionary. My first thought it to use a google spreadsheet then export it, but i'm wondering if visual studio has any built in spreadsheet thing to manage this?
12 Replies
Denis
Denis11mo ago
150 isn't really large tbh. 10000 is a larger size. Not sure what your exact goal is. Do you wish to manually set the values for each object instance? Are you setting random test data or something real? Are sure you cannot load all the data you need from, e.g., some database? Other than that, yeah, do it in some spreadsheet app, export as CSV and then write some code to load that up into your dictionary
Dawnbomb
Dawnbomb11mo ago
I am manually setting every variable of every instance as for "can i not load it from a database..." well, i mean, i am asking that right now, that IS the question, can i JUST have a giant spreadsheet within visual studio of somekind and it load interacts with it?
Angius
Angius11mo ago
Yes, you can store that data wherever A CSV file, a JSON file, anything you'd like
Dawnbomb
Dawnbomb11mo ago
well yes, i meant for simplicity, is there like, literally, some spreadsheet-like-plugin for visual studio, or some tool that VS comes with without that i'll return to just making a google sheet, it's easy enough, but it means im swapping between visual studio, google sheets, and constantly exporting stuff and something integrated would be prefered
JakenVeina
JakenVeina11mo ago
what you're looking for is a data serialization solution, it sounds like I.E. you want to define all the data outside of your program, in some human-readable fashion then have the program just load that up
Dawnbomb
Dawnbomb11mo ago
Well yes, i mean, i can just google sheets and export it, but the extra steps between inputting that info and having to actually move it over myself so the program uses the new list, vs it just already knowing, is kinda annoying. i mean, i can do it yes, i was just curious if theres any spreadsheet or similuar plugins or the like.
JakenVeina
JakenVeina11mo ago
if you REALLY want to use a spreadsheet for the input, pretty much all spreadsheet apps support exporting to CSV, which is a readily-deserializable format
Dawnbomb
Dawnbomb11mo ago
I'm aware, and i can, and i will if i don't find anything else, i just don't want to be bothered with having to click export and move it every time.
JakenVeina
JakenVeina11mo ago
then you're gonna have to dig into OpenXML which will be horrific
Dawnbomb
Dawnbomb11mo ago
that sounds horrific, i'll probably just use google sheets, i was just seeing if i couldn't find anything integrated. Oh well. On the bright side i can public link a google sheet and include extra info for people to publicly view to thats cool i guess.
JakenVeina
JakenVeina11mo ago
if Google Sheets has a public API with a ready-to-go C# wrapper, go for it just make sure and implement validation
Accord
Accord11mo ago
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.