the Clear method for the Queue class

T

Tony Johansson

Hello!

Can somebody explain what this text mean ?

When you call the Clear method for a Queue object, the capacity of the
Queue object is not changed.

//Tony
 
J

Jeff Johnson

Can somebody explain what this text mean ?

When you call the Clear method for a Queue object, the capacity of the
Queue object is not changed.

The capacity of the Queue starts out at a certain amount. As you enqueue
items, the capacity may need to increase to hold all the items. When you
clear the Queue, the capacity is not reset back to the value it originally
was when the Queue was created.

That's all.
 
W

Willem van Rumpt

Hello!

Can somebody explain what this text mean ?

When you call the Clear method for a Queue object, the capacity of the
Queue object is not changed.

//Tony

It means simply that the internal storage space for the queue is not
truncated also. More to the point, if the queue internally uses an array
to store the items, clearing the queue will remove all items from the
queue, but the internal array is not resized to reflect this.
 
A

Arne Vajhøj

Can somebody explain what this text mean ?

When you call the Clear method for a Queue object, the capacity of the
Queue object is not changed.

It means more or less what it says.

:)

The Clear method removes all items in the queue but does
not change the size of the backing storage.

To get rid of that you will need to call TrimToSize.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top