471,337 Members | 841 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Queue Collection not working properly.

MAF
I have a collection setup as a queque collection and when I attempt to deque
the collection I get two objects off of the collection instead of one. This
usually happens the first time I attempt to deque the collection here is a
sample of my object that inherits from the System.Collection.Queue

public CubeService.Common.PhysicalCubeRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Common.PhysicalCubeRequest request =
(CubeService.Common.PhysicalCubeRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}
Feb 23 '06 #1
4 1458
MAF,
How can you get two objects from the Queue when your method signature only
returns one? Unless, in some way, there is more than one call to the method?

Not sufficient code here to really be able to fully understand what is
happening.
Perhaps you could post a "short but complete" working cod sample that would
allow readers to replicate the issue?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MAF" wrote:
I have a collection setup as a queque collection and when I attempt to deque
the collection I get two objects off of the collection instead of one. This
usually happens the first time I attempt to deque the collection here is a
sample of my object that inherits from the System.Collection.Queue

public CubeService.Common.PhysicalCubeRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Common.PhysicalCubeRequest request =
(CubeService.Common.PhysicalCubeRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}

Feb 23 '06 #2
MAF
Sorry, the base.count is decreased by two items instead of by one.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:D9**********************************@microsof t.com...
MAF,
How can you get two objects from the Queue when your method signature
only
returns one? Unless, in some way, there is more than one call to the
method?

Not sufficient code here to really be able to fully understand what is
happening.
Perhaps you could post a "short but complete" working cod sample that
would
allow readers to replicate the issue?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MAF" wrote:
I have a collection setup as a queque collection and when I attempt to
deque
the collection I get two objects off of the collection instead of one.
This
usually happens the first time I attempt to deque the collection here is
a
sample of my object that inherits from the System.Collection.Queue

public CubeService.Common.PhysicalCubeRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Common.PhysicalCubeRequest request =
(CubeService.Common.PhysicalCubeRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}

Feb 23 '06 #3
So. You may have answered your own question then. What will happen if you
remove the call to base.DeQueue() in your code?

If the base.count is truly being decremented twice with a single call to
your method, then the only logical way this could happen is if Dequeue is
being called twice somehow.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MAF" wrote:
Sorry, the base.count is decreased by two items instead of by one.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:D9**********************************@microsof t.com...
MAF,
How can you get two objects from the Queue when your method signature
only
returns one? Unless, in some way, there is more than one call to the
method?

Not sufficient code here to really be able to fully understand what is
happening.
Perhaps you could post a "short but complete" working cod sample that
would
allow readers to replicate the issue?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MAF" wrote:
I have a collection setup as a queque collection and when I attempt to
deque
the collection I get two objects off of the collection instead of one.
This
usually happens the first time I attempt to deque the collection here is
a
sample of my object that inherits from the System.Collection.Queue

public CubeService.Common.PhysicalCubeRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Common.PhysicalCubeRequest request =
(CubeService.Common.PhysicalCubeRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}


Feb 23 '06 #4
MAF,

Can you provide a short, but complete program that demonstrates the
problem?

Brian

MAF wrote:
I have a collection setup as a queque collection and when I attempt to deque
the collection I get two objects off of the collection instead of one. This
usually happens the first time I attempt to deque the collection here is a
sample of my object that inherits from the System.Collection.Queue

public CubeService.Common.PhysicalCubeRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Common.PhysicalCubeRequest request =
(CubeService.Common.PhysicalCubeRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}


Feb 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.