Most Efficient way to create list of all existing items in ConcurrentQueue at certain timestamp
<p>I have to maintain information logs , these logs can be written from many threads concurrently, but when I need them I am using only one thread to dequeue it that takes break of around 5 seconds between dequeueing the collection.</p>

<p>Following is the code I've written to Dequeue it.</p>

<pre><code>if (timeNotReached)
{
   InformationLogQueue.Enqueue(informationLog);
}
else
{
    int currentLogCount = InformationLogQueue.Count;
            var informationLogs = new List&lt;InformationLog&gt;();
            for (int i = 0; i &lt; currentLogCount; i++)
            {
                InformationLog informationLog1;
                InformationLogQueue.TryDequeue(out informationLog1);
                informationLogs.Add(informationLog1);
            }
    WriteToDatabase(informationLogs);
}
</code></pre>

<p>After dequeueing I am passing it to LINQ's insert method that requires List of InformationLog to insert to database.</p>

<p>Is this the correct way or is there any other efficient way to do this?</p>
