Reputation: 1194
is it ok to declare a Queue of List<T>
as the following:
private static Queue<List<object>> webdata = new Queue<List<object>>();
my list of objects normally contains couple datatables and some other objects
Upvotes: 0
Views: 1112
Reputation: 150118
private static Queue<List<object>> webdata = new Queue<List<object>>();
Sure you can declare a data type like that.
if the Queue count was 100 how do i tell the thread that does the Enqueue to stop until the count of the Queue is less than 50?
This is a perfect job for TPL Dataflow. You can control how many items may be in a processing block before it blocks accepting additional items.
If you have not learned about TPL Dataflow yet, it will require an investment in time to understand the concepts. However, it is ideally suited for this type of processing and likely well worth the effort.
Upvotes: 2