Hi,
I have a class which looks like this (the class is then used to read back from a webservice)
Elsewhere in my code I have the following
Problem is coming from the catch. AIUI, what I've done is correct as I've instantated a new list. OK, it doesn't contain anything at the top, but the way I've addressed the list should be correct - but it dies the code dies at the adding of the line.
Do I need to have a line at the top of the code that says
before I can do something like this? I obviously can't use chunky.Add(o.To String()); here as the poor compiler won't know what in the generic list has to have the string added to it...
Any help here would be appreciated.
Paul
I have a class which looks like this (the class is then used to read back from a webservice)
Code:
class fred
{
string jim;
string hilda;
int eccles;
bool crunn;
double vodka;
}
Code:
public void doSomething()
{
List<fred> chunky = new List<fred>();
try
{
webservice r = new webservice();
chunky = r.returnedList;
// do something
}
catch (System.Exception o)
{
fred[0].jim = o.ToString();
// do something else
}
}
Do I need to have a line at the top of the code that says
Code:
chunky = null;
Any help here would be appreciated.
Paul
Comment