G
Guest
Dear Friends,
I'll be glad if you guys could help out. I am currently doing a web project
in asp.net using c#. An ArrayList object in my code contains element records
containing 3 fields. In a particular portion of the code, I am trying to edit
my ArrayList object, i.e. edit a particular field in the list, but am unable
to do that succesfully. To illustrate my point further please see the code
below: -
private void EditQuestion(int index,int value)
{
//Edit the required Question.
ArrayList qh = (ArrayList)this.Session["QuestionHierarchy"];
if (qh != null)
{
((QInfo)qh[index]).ChildElements = value;
}
this.Session["QuestionHierarchy"] = qh;
}
where the Array list consists of item of type ContolInfo defined like this: -
private struct QInfo
{
public string ID;
public int ChildElements;
public int Parent;
}
I keep getting this compilation error..at the following line of code..given
above..
The left-hand side of an assignment must be a variable, property or indexer
-----> ((QInfo)qh[index]).ChildElements = value;
You might find this error trivial, but am stuck on this for quite a while.
Please help me out...will appreciate it..will wait for a useful reponse...
Many Thanks,
Irfan
I'll be glad if you guys could help out. I am currently doing a web project
in asp.net using c#. An ArrayList object in my code contains element records
containing 3 fields. In a particular portion of the code, I am trying to edit
my ArrayList object, i.e. edit a particular field in the list, but am unable
to do that succesfully. To illustrate my point further please see the code
below: -
private void EditQuestion(int index,int value)
{
//Edit the required Question.
ArrayList qh = (ArrayList)this.Session["QuestionHierarchy"];
if (qh != null)
{
((QInfo)qh[index]).ChildElements = value;
}
this.Session["QuestionHierarchy"] = qh;
}
where the Array list consists of item of type ContolInfo defined like this: -
private struct QInfo
{
public string ID;
public int ChildElements;
public int Parent;
}
I keep getting this compilation error..at the following line of code..given
above..
The left-hand side of an assignment must be a variable, property or indexer
-----> ((QInfo)qh[index]).ChildElements = value;
You might find this error trivial, but am stuck on this for quite a while.
Please help me out...will appreciate it..will wait for a useful reponse...
Many Thanks,
Irfan