(Current) AI Rant.
-
Me, wanting to "peek" the "last" entry in a ConcurrentQueue, because the "next" entry I will enqueue needs "prior info" if it exists. I can use ToArray, and GetEnumerator. Surprising .Last() compiles but I thought I'd "Bing" anyway. Me: peek last entry in concurrentqueue Copilot with GPT-4:
Quote:
Certainly! In C#, if you want to peek at the last entry in a ConcurrentQueue, you can use the TryPeek method. Here’s an example:
(Some "wrong" / right code).
Quote:
In this example, the TryPeek method allows you to examine the last item in the queue without removing it. If the queue is empty, it returns false, and you can handle that case accordingly. If you have any more questions or need further assistance, feel free to ask! 😊
MSDN re: TryPeek:
Quote:
Tries to return an object from the beginning of the ConcurrentQueue without removing it.
Seems it can't differentiate a queue from a stack. Nice. VS is also getting more "aggressive" when it's getting it wrong.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
Me, wanting to "peek" the "last" entry in a ConcurrentQueue, because the "next" entry I will enqueue needs "prior info" if it exists. I can use ToArray, and GetEnumerator. Surprising .Last() compiles but I thought I'd "Bing" anyway. Me: peek last entry in concurrentqueue Copilot with GPT-4:
Quote:
Certainly! In C#, if you want to peek at the last entry in a ConcurrentQueue, you can use the TryPeek method. Here’s an example:
(Some "wrong" / right code).
Quote:
In this example, the TryPeek method allows you to examine the last item in the queue without removing it. If the queue is empty, it returns false, and you can handle that case accordingly. If you have any more questions or need further assistance, feel free to ask! 😊
MSDN re: TryPeek:
Quote:
Tries to return an object from the beginning of the ConcurrentQueue without removing it.
Seems it can't differentiate a queue from a stack. Nice. VS is also getting more "aggressive" when it's getting it wrong.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
It is not intelligent. Marketing sells it like it is, but we are far away from thinking machines. :thumbsup:
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
Me, wanting to "peek" the "last" entry in a ConcurrentQueue, because the "next" entry I will enqueue needs "prior info" if it exists. I can use ToArray, and GetEnumerator. Surprising .Last() compiles but I thought I'd "Bing" anyway. Me: peek last entry in concurrentqueue Copilot with GPT-4:
Quote:
Certainly! In C#, if you want to peek at the last entry in a ConcurrentQueue, you can use the TryPeek method. Here’s an example:
(Some "wrong" / right code).
Quote:
In this example, the TryPeek method allows you to examine the last item in the queue without removing it. If the queue is empty, it returns false, and you can handle that case accordingly. If you have any more questions or need further assistance, feel free to ask! 😊
MSDN re: TryPeek:
Quote:
Tries to return an object from the beginning of the ConcurrentQueue without removing it.
Seems it can't differentiate a queue from a stack. Nice. VS is also getting more "aggressive" when it's getting it wrong.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
Me, wanting to "peek" the "last" entry in a ConcurrentQueue, because the "next" entry I will enqueue needs "prior info" if it exists. I can use ToArray, and GetEnumerator. Surprising .Last() compiles but I thought I'd "Bing" anyway. Me: peek last entry in concurrentqueue Copilot with GPT-4:
Quote:
Certainly! In C#, if you want to peek at the last entry in a ConcurrentQueue, you can use the TryPeek method. Here’s an example:
(Some "wrong" / right code).
Quote:
In this example, the TryPeek method allows you to examine the last item in the queue without removing it. If the queue is empty, it returns false, and you can handle that case accordingly. If you have any more questions or need further assistance, feel free to ask! 😊
MSDN re: TryPeek:
Quote:
Tries to return an object from the beginning of the ConcurrentQueue without removing it.
Seems it can't differentiate a queue from a stack. Nice. VS is also getting more "aggressive" when it's getting it wrong.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
Besides AI getting it wrong: 1) If you have concurrent writers to the queue you do not know something else does not insert a new "last" item after you checked what it is. This can of course be solved with some locking, but then we are at the next point: 2) If you do not have concurrent writers you can just capture the last item to a variable as you enqueue it.