Click here to Skip to main content
14,538,718 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
AnswerRe: An opinion on naming Pin
0x01AA5-Dec-19 7:57
mve0x01AA5-Dec-19 7:57 
AnswerRe: An opinion on naming Pin
Eddy Vluggen5-Dec-19 7:58
professionalEddy Vluggen5-Dec-19 7:58 
AnswerRe: An opinion on naming Pin
Greg Utas5-Dec-19 8:03
professionalGreg Utas5-Dec-19 8:03 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 8:04
mvahoney the codewitch5-Dec-19 8:04 
GeneralRe: An opinion on naming Pin
Sander Rossel5-Dec-19 8:25
professionalSander Rossel5-Dec-19 8:25 
AnswerRe: An opinion on naming Pin
Marc Clifton5-Dec-19 8:07
mvaMarc Clifton5-Dec-19 8:07 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 8:09
mvahoney the codewitch5-Dec-19 8:09 
AnswerRe: An opinion on naming Pin
Sander Rossel5-Dec-19 8:39
professionalSander Rossel5-Dec-19 8:39 
From the top of my head.
public static T GetAtIndex(this Queue<T> queue, int index)
{
    T obj = default(T);
    int count = queue.Count;
    for (int i = 0; i < count; i += 1)
    {
        T temp = queue.Dequeue();
        if (i == index)
        {
            obj = temp;
        }
        queue.Enqueue(temp);
    }
    return obj;
}
I'm pretty sure that's how Microsoft intended it Big Grin | :-D
It's lightning fast if you have only a few items and you don't do it too often Laugh | :laugh:

Or you could do whatever you're doing an name it IndexedQueue, like Greg also suggested.

GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 8:40
mvahoney the codewitch5-Dec-19 8:40 
GeneralRe: An opinion on naming Pin
Sander Rossel5-Dec-19 8:50
professionalSander Rossel5-Dec-19 8:50 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 8:53
mvahoney the codewitch5-Dec-19 8:53 
GeneralRe: An opinion on naming Pin
Sander Rossel5-Dec-19 9:13
professionalSander Rossel5-Dec-19 9:13 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 9:27
mvahoney the codewitch5-Dec-19 9:27 
GeneralRe: An opinion on naming Pin
Sander Rossel5-Dec-19 10:18
professionalSander Rossel5-Dec-19 10:18 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 10:28
mvahoney the codewitch5-Dec-19 10:28 
AnswerRe: An opinion on naming Pin
Rick York5-Dec-19 10:44
mveRick York5-Dec-19 10:44 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 10:45
mvahoney the codewitch5-Dec-19 10:45 
GeneralRe: An opinion on naming Pin
Rick York5-Dec-19 14:49
mveRick York5-Dec-19 14:49 
GeneralRe: An opinion on naming Pin
honey the codewitch5-Dec-19 14:51
mvahoney the codewitch5-Dec-19 14:51 
AnswerRe: An opinion on naming Pin
AFell25-Dec-19 11:51
MemberAFell25-Dec-19 11:51 
GeneralCannot see items in an STL container in VS2017 Pin
Greg Utas5-Dec-19 7:09
professionalGreg Utas5-Dec-19 7:09 
GeneralRe: Cannot see items in an STL container in VS2017 Pin
Richard MacCutchan5-Dec-19 7:46
mveRichard MacCutchan5-Dec-19 7:46 
GeneralRe: Cannot see items in an STL container in VS2017 Pin
Greg Utas5-Dec-19 7:59
professionalGreg Utas5-Dec-19 7:59 
GeneralKeyboard recommendations Pin
Mike Hankey5-Dec-19 5:20
professionalMike Hankey5-Dec-19 5:20 
GeneralRe: Keyboard recommendations Pin
PIEBALDconsult5-Dec-19 5:27
professionalPIEBALDconsult5-Dec-19 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.