3

assume I have a class with List<T> member. Let's say I'm not sure how many items will be pushed inside (but I don't want to do it as blocked list) - and this list contains sliding window of items from the last 24 hours (and I access it with LINQ queries).

Is there a neat way to tell the list to serialize itself to some disk file to avoid out of memory and desiralize itself when items are removed again from the list? (File Stream or something)

Or do I need to write the mechanism myself?

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
user1025852
  • 2,684
  • 11
  • 36
  • 58

3 Answers3

9

Generally, this is what you'd use a database for.

spender
  • 117,338
  • 33
  • 229
  • 351
  • 2
    +1 There are [many light weight databases](http://stackoverflow.com/questions/572804/single-user-database-options) that can be deployed with your application that require no install on the part of the user. – Scott Chamberlain Aug 13 '12 at 13:30
1

You can XML Searialization to store whole class with properties as xml into your database(xml type if you use MS SQL) or into xml file,and then when needed deserialize it back.

formatc
  • 4,261
  • 7
  • 43
  • 81
0

No, there's no such a way, even more so with your requirement of LINQ accessibility.

Sergei Rogovtcev
  • 5,804
  • 2
  • 22
  • 35