Click here to Skip to main content
15,901,283 members
Home / Discussions / C#
   

C#

 
QuestionStoring data in an array Pin
Brad Wick15-May-08 6:03
Brad Wick15-May-08 6:03 
AnswerRe: Storing data in an array Pin
led mike15-May-08 6:19
led mike15-May-08 6:19 
GeneralRe: Storing data in an array Pin
Brad Wick15-May-08 6:45
Brad Wick15-May-08 6:45 
GeneralRe: Storing data in an array Pin
led mike15-May-08 6:51
led mike15-May-08 6:51 
AnswerRe: Storing data in an array Pin
Bert delaVega15-May-08 6:47
Bert delaVega15-May-08 6:47 
GeneralRe: Storing data in an array Pin
Brad Wick15-May-08 7:11
Brad Wick15-May-08 7:11 
GeneralRe: Storing data in an array Pin
Bert delaVega15-May-08 7:28
Bert delaVega15-May-08 7:28 
AnswerRe: Storing data in an array Pin
DaveyM6916-May-08 2:36
professionalDaveyM6916-May-08 2:36 
The way I normally handle this is to create a class (or struct if more appropriate) for a single item, then create a class that is a generic list of single items.

e.g.
public class MyMessage
{
   // variables, properties, methods, constructors etc...
}

using System.Collections.Generic;
public class MyMessageCollection : List<MyMessage>
{
   // returns the message with specified ID or new empty message if not found
   public MyMessage FindItemFromID(int id)
   {
      MyMessage found = this.Find(c => c.ID == id);
      return found != null ? found : new MyMessage();
   }

   // other methods (loading, saving...) etc...
}


Dave

QuestionArray.resize Pin
C++NewBe15-May-08 5:55
C++NewBe15-May-08 5:55 
AnswerRe: Array.resize Pin
led mike15-May-08 6:13
led mike15-May-08 6:13 
GeneralRe: Array.resize Pin
Dave Doknjas15-May-08 15:30
Dave Doknjas15-May-08 15:30 
GeneralRe: Array.resize Pin
led mike16-May-08 5:15
led mike16-May-08 5:15 
AnswerRe: Array.resize Pin
#realJSOP15-May-08 6:30
professional#realJSOP15-May-08 6:30 
QuestionInstance Failure Error Pin
Banjo Ayorinde15-May-08 5:22
Banjo Ayorinde15-May-08 5:22 
AnswerRe: Instance Failure Error Pin
led mike15-May-08 6:08
led mike15-May-08 6:08 
QuestionInterface C#.NET with MOA 2007/2008 Pin
Dinker Batra15-May-08 5:19
Dinker Batra15-May-08 5:19 
AnswerRe: Interface C#.NET with MOA 2007/2008 Pin
led mike15-May-08 6:07
led mike15-May-08 6:07 
AnswerRe: Interface C#.NET with MOA 2007/2008 Pin
Bert delaVega15-May-08 7:02
Bert delaVega15-May-08 7:02 
QuestionHow to determine if my website is down or up using C# Pin
mdpavel15-May-08 5:11
mdpavel15-May-08 5:11 
AnswerRe: How to determine if my website is down or up using C# Pin
led mike15-May-08 6:01
led mike15-May-08 6:01 
AnswerRe: How to determine if my website is down or up using C# Pin
Bert delaVega15-May-08 6:32
Bert delaVega15-May-08 6:32 
GeneralRe: How to determine if my website is down or up using C# Pin
mdpavel15-May-08 8:04
mdpavel15-May-08 8:04 
GeneralRe: How to determine if my website is down or up using C# Pin
Bert delaVega15-May-08 10:34
Bert delaVega15-May-08 10:34 
QuestionProblem with setting gif images to transparent. Pin
hdv21215-May-08 4:14
hdv21215-May-08 4:14 
QuestionBest way to debug a Windows Service Pin
Christiaan Laubscher15-May-08 2:56
Christiaan Laubscher15-May-08 2:56 

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.