Click here to Skip to main content
15,913,773 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionLinq and IEnumerable - case insensitive? Pin
shn40023-Dec-09 16:31
shn40023-Dec-09 16:31 
AnswerRe: Linq and IEnumerable - case insensitive? Pin
Luc Pattyn3-Dec-09 16:45
sitebuilderLuc Pattyn3-Dec-09 16:45 
GeneralRe: Linq and IEnumerable - case insensitive? Pin
Mark Salsbery3-Dec-09 19:27
Mark Salsbery3-Dec-09 19:27 
GeneralRe: Linq and IEnumerable - case insensitive? Pin
Pete O'Hanlon3-Dec-09 23:49
mvePete O'Hanlon3-Dec-09 23:49 
GeneralRe: Linq and IEnumerable - case insensitive? Pin
Luc Pattyn4-Dec-09 1:06
sitebuilderLuc Pattyn4-Dec-09 1:06 
AnswerRe: Linq and IEnumerable - case insensitive? Pin
N a v a n e e t h3-Dec-09 16:52
N a v a n e e t h3-Dec-09 16:52 
GeneralRe: Linq and IEnumerable - case insensitive? Pin
shn40023-Dec-09 17:23
shn40023-Dec-09 17:23 
QuestionProblem with List<> Pin
polomint3-Dec-09 7:40
polomint3-Dec-09 7:40 
Hi,

I have a problem with VS2010beta2 and .NET Framework Client Profile, although I would expect the problem to be something to do with my inexperienced coding.

I have this block of code..

struct sGamePort
{
    public string sgpProtocol;
    public UInt16 sgpPortStart;
    public UInt16 sgpPortEnd;
}

struct sGamePortItem
{
    public string sgpName;
    public List<sGamePort> sgpPortList;
}

List<sGamePortItem> sGames;


private sGamePort ParsePorts(string[] line)
{
    sGamePort gp = new sGamePort();
    gp.sgpProtocol = line[0];
    int num = line.Count();
    if (num == 2)
    {
        // single port opened...
        gp.sgpPortStart =  Convert.ToUInt16(line[1]);
        gp.sgpPortEnd = Convert.ToUInt16(line[1]);
    }
    if (num == 3)
    {
        // port range opened...
        gp.sgpPortStart = Convert.ToUInt16(line[1]);
        gp.sgpPortEnd = Convert.ToUInt16(line[2]);
    }
    return gp;
}


Where line is a string array which essentially holds some tokens.
ie.
line[0] = "NAME"
line[1] = "JOHN"
line[2] = "YOUNG"

Now, in a seperate function I have

sGamePortItem pi = new sGamePortItem();
pi.sgpProtocol = "TCP";
pi.sgpPortList.Add(ParsePorts(strCMD));


This gives me a Null Reference Exception, so I changed it to this...

sGamePortItem pi = new sGamePortItem();
pi.sgpProtocol = "TCP";
sGamePort test = new sGamePort();
test = ParsePorts(strCMD);
pi.sgpPortList.Add(test); // ERROR HERE


Now, the error only occurs on the specified line above.. What am I doing wrong? Is it to do with me using the new keyword incorrectly? Or do I not use 'new'?

Any help would be appreciated as this has been confusing me for a few hours now, lol

Thanks again.

John

Yippee Kai Yai
Signed Polomint.......

AnswerRe: Problem with List&lt;&gt; Pin
vtchris-peterson3-Dec-09 7:57
vtchris-peterson3-Dec-09 7:57 
GeneralRe: Problem with List&lt;&gt; [modified] Pin
polomint3-Dec-09 7:59
polomint3-Dec-09 7:59 
AnswerRe: Problem with List&lt;&gt; Pin
puri keemti3-Dec-09 22:48
puri keemti3-Dec-09 22:48 
QuestionHold the parent session when calling a showModalDialog child Pin
Jose Alvarez de Lara3-Dec-09 4:37
Jose Alvarez de Lara3-Dec-09 4:37 
AnswerRe: Hold the parent session when calling a showModalDialog child Pin
puri keemti3-Dec-09 22:55
puri keemti3-Dec-09 22:55 
GeneralRe: Hold the parent session when calling a showModalDialog child Pin
Jose Alvarez de Lara4-Dec-09 0:11
Jose Alvarez de Lara4-Dec-09 0:11 
GeneralRe: Hold the parent session when calling a showModalDialog child Pin
Jose Alvarez de Lara7-Dec-09 8:37
Jose Alvarez de Lara7-Dec-09 8:37 
GeneralRe: Hold the parent session when calling a showModalDialog child Pin
Jose Alvarez de Lara8-Dec-09 5:47
Jose Alvarez de Lara8-Dec-09 5:47 
QuestionDesignSurface Serialization problems Pin
nicolas.alonzo3-Dec-09 3:47
nicolas.alonzo3-Dec-09 3:47 
AnswerRe: DesignSurface Serialization problems Pin
nicolas.alonzo21-Dec-09 22:05
nicolas.alonzo21-Dec-09 22:05 
QuestionADO Delimiters: Space and Tab Pin
T21022-Dec-09 17:56
T21022-Dec-09 17:56 
AnswerRe: ADO Delimiters: Space and Tab Pin
RCoate2-Dec-09 20:13
RCoate2-Dec-09 20:13 
GeneralRe: ADO Delimiters: Space and Tab Pin
T21022-Dec-09 20:49
T21022-Dec-09 20:49 
QuestionSave Variable Values to a file and start another application when unhandled error occurs Pin
Mehdi Ghiasi2-Dec-09 2:51
Mehdi Ghiasi2-Dec-09 2:51 
AnswerRe: Save Variable Values to a file and start another application when unhandled error occurs Pin
Eddy Vluggen2-Dec-09 3:29
professionalEddy Vluggen2-Dec-09 3:29 
GeneralRe: Save Variable Values to a file and start another application when unhandled error occurs Pin
Mehdi Ghiasi2-Dec-09 3:33
Mehdi Ghiasi2-Dec-09 3:33 
GeneralRe: Save Variable Values to a file and start another application when unhandled error occurs Pin
Eddy Vluggen2-Dec-09 4:11
professionalEddy Vluggen2-Dec-09 4:11 

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.