Mass filtration with protobuff set

I am serializing a list of objects with protobuf-net.

Theoretically, a .bin file can contain millions of objects.

Suppose objects belong to a class that contains the following:

public string EventName;

I need to take a query and create a list containing objects matching the query. What is the correct way to extract matching objects from a serialized file using LINQ?

+5
source share
4 answers

The protobuf format is a linear sequence of elements; any indexing, etc., you can apply only separately. However IEnumerable<T>available; You may find that:

var item = Serializer.DeserializeItems<YourType>(source)
       .First(item => item.Id == id);

does work beautifully; this:

  • ; , .
  • ; ,

:

var list = Serializer.DeserializeItems<YourType>(source)
    .Where(item => item.Foo == foo);

( ToList , ToList, )

+5
+1

, . LINQ, IQueryable<T>, IEnumerable<T>. LINQ-, IQueryable<T> .bin , :

  • LINQ-to-objects IEnumerable<T>
  • LINQ, IQueryable<T> ( , , , HUGE), , .
0

protobuf IEnumerable<T>, . , , , .

0

All Articles