简体   繁体   中英

What is the fastest and most efficient way to search a csv with XamarinForms?

I've a large CSV file with about 500 rows and 10 columns that I need to search quite fluidly via several criteria at the heart of an application, and then populate a list quickly via the results of different cells (which will change rapidly as the user plays with it.

Would it be better to search the csv file directly, or create some sort of datastructure and import the csv to it?

My guess is the latter.

If I am correct, how would CSVTools cover the import in XamarinForms (I've seen very little documentation), and which data structure would work the best? I've seen a bit of information that dictionaries would be a terrible choice, but what does that leave me?

Every cell of the table will need to be searchable via several criteria such as the first two letters of a string, a math comparison, alphabetical order, and whether a bool is true or false.

I know I can iterate through it all, but due to the size of the table I would imagine there is something better suited available.

I am truly open to all suggestions, especially if I am doing this in an entirely incorrect way due to inexperience.

Thanks!

Josh, I was in the very same position as you a while back.

I made the decision to import my CSV into a SQLite Database . SQLite is easy to query and sort, and there's simply a lot more support for it than CSV in C#. It's a one-time transition and the most difficult part is switching over. From my experience working in CSV in Python (obviously going to be different from C#) , CSVs are far more annoying to manipulate than SQLite documents.

Here's a good program you can use to import your CSV to SQLite.

SQLite-net-pcl is a good library you can use to access SQLite in Xamarin.

Best of luck Josh!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM