473,604 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Collecti on.Queue

public CubeService.Com mon.PhysicalCub eRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Com mon.PhysicalCub eRequest request =
(CubeService.Co mmon.PhysicalCu beRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}
Feb 23 '06 #1
4 1551
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.Collecti on.Queue

public CubeService.Com mon.PhysicalCub eRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Com mon.PhysicalCub eRequest request =
(CubeService.Co mmon.PhysicalCu beRequest) 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*******@yaho o.nospammin.com > wrote in message
news:D9******** *************** ***********@mic rosoft.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.Collecti on.Queue

public CubeService.Com mon.PhysicalCub eRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Com mon.PhysicalCub eRequest request =
(CubeService.Co mmon.PhysicalCu beRequest) 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*******@yaho o.nospammin.com > wrote in message
news:D9******** *************** ***********@mic rosoft.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.Collecti on.Queue

public CubeService.Com mon.PhysicalCub eRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Com mon.PhysicalCub eRequest request =
(CubeService.Co mmon.PhysicalCu beRequest) 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.Collecti on.Queue

public CubeService.Com mon.PhysicalCub eRequest DequeueLocal()

{

if (base.Count > 0)

{

CubeService.Com mon.PhysicalCub eRequest request =
(CubeService.Co mmon.PhysicalCu beRequest) base.Dequeue();

return (request);

}

else

{

return null;

}

}


Feb 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4976
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
4
8177
by: nhmark64 | last post by:
Hi, Does System.Collections.Generic.Queue not have a Synchronized method because it is already in effect synchronized, or is the Synchronized functionality missing from System.Collections.Generic.Queue? Putting it another way can I safely replace a System.Collections.Queue.Synchronized(myUnSynchronizedQueue) with a System.Collections.Generic.Queue while porting a working 2003 project? Thanks,
0
995
by: MAF | last post by:
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() {
1
1223
by: falcon198198 | last post by:
Greetings: I was hoping for some advice on an application. Here is what I am working on: Basically I have a bigger application that is having a printing problem making multiple copies of a pdf so I set off to write a program that can watch a folder using filesystemwatcher. From the events that this generates I created a class and instantiated an object that will hold information like full path and last write time. I want to be able to...
0
7929
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8409
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
3907
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.