Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

How to store data in a class library/NuGet package?

$
0
0

I am currently creating a class library to analyze the syntactic correctness of Italian fiscal codes. I want to include it in a NuGet package and publish it. I have a main static class and a bunch of methods, some of which use fixed data on Italian municipalities (to match birthplaces). I'm currently storing the cities data in a fairly large places.json file, which is opened and read every time the function is called... Do I have better alternatives? For example, storing data in a places.cs file (compiled at the end) looks ugly, but at least is more efficient.

I'm using a JSON file because it is easy to read and edit with different tools and languages. However, having to open the file every time the function is invoked seems slow and an unnecessary waste of computational power. Having data in memory, ready to be accessed, seems a better solution. This is the context of my question but, in short, which is the best practice to store read-only data in a class library/NuGet package?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>