Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exe Generate anonmyous files Pin
Anthony Mushrow2-Sep-08 23:47
professionalAnthony Mushrow2-Sep-08 23:47 
GeneralRe: Exe Generate anonmyous files Pin
Syed Shahid Hussain3-Sep-08 17:56
Syed Shahid Hussain3-Sep-08 17:56 
QuestionSearching for a matching item in a linked list based queue Pin
Angelinna2-Sep-08 23:03
Angelinna2-Sep-08 23:03 
AnswerRe: Searching for a matching item in a linked list based queue Pin
c24233-Sep-08 3:13
c24233-Sep-08 3:13 
GeneralRe: Searching for a matching item in a linked list based queue Pin
Angelinna3-Sep-08 20:49
Angelinna3-Sep-08 20:49 
GeneralRe: Searching for a matching item in a linked list based queue Pin
c24233-Sep-08 22:10
c24233-Sep-08 22:10 
GeneralRe: Searching for a matching item in a linked list based queue Pin
Angelinna4-Sep-08 1:22
Angelinna4-Sep-08 1:22 
GeneralRe: Searching for a matching item in a linked list based queue Pin
c24234-Sep-08 1:41
c24234-Sep-08 1:41 
Ok - seems like you might be implimenting your own version of a Queue, which internally is using List<t>? In which case you would need to work out an algorithm for this...

Anyway, assuming you are using System.Collections.Generic.Queue<T> you can use the "Contains" method, for example:

Queue<string> q = new Queue<string>();
//Initialise Queue here

bool b = q.Contains("Hello world");


As for getting based on an ID number, Im not sure what you are wanting:
-If you want to do this like an index number (i.e. "Get the second item in the queue"), you can use an iterator (see foreach), or can cast it to an array (using ToArray) before getting the value.
-If each item in the Queue has a unique id number, which does not correspond to its index in the queue, you could try iterating until a condition is met
For example:
foreach(item x in queue)
{
  if(x.Id == IdWeAreSearchingFor)
  {
    //Found a match, so do whatever we need to do with it
    break;
  }
}


Maybe one of these approaches will help you get a bit further, but if not let me know. It would be helpful to know if you are using Queue<t> or making your own Queue class based on List<t> if none of these suggestions helped!

Chris
QuestionPanel_DragDrop Pin
samulong2-Sep-08 22:59
samulong2-Sep-08 22:59 
QuestionIs it possible to save Visual Studio control state ? Pin
AYK_1612-Sep-08 21:27
AYK_1612-Sep-08 21:27 
AnswerRe: Is it possible to save Visual Studio control state ? Pin
JoeSharp2-Sep-08 21:53
JoeSharp2-Sep-08 21:53 
GeneralRe: Is it possible to save Visual Studio control state ? Pin
AYK_1612-Sep-08 22:18
AYK_1612-Sep-08 22:18 
QuestionUI Control Help Pin
Syed Shahid Hussain2-Sep-08 21:26
Syed Shahid Hussain2-Sep-08 21:26 
AnswerRe: UI Control Help Pin
AhsanS2-Sep-08 22:10
AhsanS2-Sep-08 22:10 
GeneralRe: UI Control Help Pin
Syed Shahid Hussain2-Sep-08 22:40
Syed Shahid Hussain2-Sep-08 22:40 
GeneralRe: UI Control Help Pin
Pete O'Hanlon3-Sep-08 2:05
mvePete O'Hanlon3-Sep-08 2:05 
GeneralRe: UI Control Help Pin
Syed Shahid Hussain3-Sep-08 18:00
Syed Shahid Hussain3-Sep-08 18:00 
QuestionHow to save something in memory to file? Pin
gigahertz2052-Sep-08 16:04
gigahertz2052-Sep-08 16:04 
AnswerRe: How to save something in memory to file? Pin
TheFM2342-Sep-08 19:29
TheFM2342-Sep-08 19:29 
AnswerRe: How to save something in memory to file? Pin
Stephen Lintott3-Sep-08 4:08
Stephen Lintott3-Sep-08 4:08 
Generalhelp with webbrowser control C#. net [modified] Solved Pin
Filmxposer2-Sep-08 14:15
Filmxposer2-Sep-08 14:15 
AnswerRe: help with webbrowser control C#. net Pin
Filmxposer2-Sep-08 15:06
Filmxposer2-Sep-08 15:06 
GeneralRe: help with webbrowser control C#. net Pin
#realJSOP2-Sep-08 23:24
mve#realJSOP2-Sep-08 23:24 
QuestionMy Printer CLass Pin
Silvyster2-Sep-08 14:13
Silvyster2-Sep-08 14:13 
AnswerRe: My Printer CLass Pin
JoeSharp2-Sep-08 22:04
JoeSharp2-Sep-08 22:04 

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.