Click here to Skip to main content
15,910,872 members
Home / Discussions / C#
   

C#

 
AnswerRe: Are Settings variables thread safe ? Pin
Judah Gabriel Himango6-Nov-06 9:46
sponsorJudah Gabriel Himango6-Nov-06 9:46 
GeneralRe: Are Settings variables thread safe ? Pin
Nadia Monalisa6-Nov-06 9:51
Nadia Monalisa6-Nov-06 9:51 
QuestionHow to parse database address Pin
AndrusM6-Nov-06 7:00
AndrusM6-Nov-06 7:00 
AnswerRe: How to parse database address Pin
Judah Gabriel Himango6-Nov-06 9:48
sponsorJudah Gabriel Himango6-Nov-06 9:48 
QuestionPOS application Pin
Harikrk6-Nov-06 6:56
Harikrk6-Nov-06 6:56 
AnswerRe: POS application Pin
ednrgc6-Nov-06 9:14
ednrgc6-Nov-06 9:14 
GeneralRe: POS application Pin
Dan Neely6-Nov-06 10:03
Dan Neely6-Nov-06 10:03 
GeneralRe: POS application Pin
ednrgc7-Nov-06 2:18
ednrgc7-Nov-06 2:18 
AnswerRe: POS application Pin
Dan Neely6-Nov-06 10:02
Dan Neely6-Nov-06 10:02 
GeneralRe: POS application Pin
Harikrk7-Nov-06 15:35
Harikrk7-Nov-06 15:35 
QuestionTwo questions on COM Add-in for Outlook 2003 Pin
OctopusThu6-Nov-06 6:47
OctopusThu6-Nov-06 6:47 
AnswerRe: Two questions on COM Add-in for Outlook 2003 Pin
OctopusThu6-Nov-06 15:42
OctopusThu6-Nov-06 15:42 
AnswerRe: Two questions on COM Add-in for Outlook 2003 Pin
OctopusThu6-Nov-06 19:53
OctopusThu6-Nov-06 19:53 
Question.NET remoting with DCOM Pin
Andy UK6-Nov-06 6:31
Andy UK6-Nov-06 6:31 
QuestionXML: Deserialize but don't Serialize Pin
Clive Pottinger6-Nov-06 5:58
Clive Pottinger6-Nov-06 5:58 
AnswerRe: XML: Deserialize but don't Serialize Pin
led mike6-Nov-06 9:21
led mike6-Nov-06 9:21 
AnswerRe: XML: Deserialize but don't Serialize Pin
beatles16927-Nov-06 0:28
beatles16927-Nov-06 0:28 
GeneralRe: XML: Deserialize but don't Serialize Pin
Clive Pottinger8-Nov-06 14:52
Clive Pottinger8-Nov-06 14:52 
GeneralRe: XML: Deserialize but don't Serialize Pin
Clive Pottinger8-Nov-06 16:54
Clive Pottinger8-Nov-06 16:54 
QuestionXML Deserialization question Pin
Clive Pottinger6-Nov-06 5:49
Clive Pottinger6-Nov-06 5:49 
Hello everyone,

My questions is in regards to finding information for an ancestor item while deserialising an XML document. The following is similar to the problem I am facing:
<teacher name="Johnson">
<class name="Hydrodynamics 101">
<student name="Billy"/>
</course>
</teacher>

I have classes for objects Teacher, Class and Student.

When a Teacher is deserialised, all the Class objects are created and passed to Teacher.AddClasses where each class is added to a private ArrayList Teacher.ClassList. Additionally, the Class.TeacherName is set. So far so good.

But during the creation of the Class objects, C# needs to create the Student objects. So the Student objects are deserialised BEFORE the Class objects are passed to Teacher.AddClasses. We are getting there...

When a Student object is created, I wish to add the student to the ArrayList Teacher.StudentList. That is a problem. Because the Class has not yet been added to the Teacher and had the Class.TeacherName value set, the Student object is unable to find out which Teacher it should be added to. We can't even search the Teacher objects looking for one that has that Class in Teacher.ClassList, because the Class has not been added there yet either.

Does anyone know a way around this? Is there a way, during deserialisation, to find out the Student["billy"] belongs to Teacher["Johnson"]?

Note: This is not exactly the situation I am facing: it is just a simplified example. So, though it may seem easier to rearrange the XML into a better order, that is not going to be an option for me. I need to deserialise object C inside B inside A and add C to a value in A while doing so.

Many thanks in advance.

Clive Pottinger,
Hamilton ON
AnswerRe: XML Deserialization question Pin
S. Senthil Kumar6-Nov-06 6:41
S. Senthil Kumar6-Nov-06 6:41 
GeneralRe: XML Deserialization question [modified] Pin
Clive Pottinger6-Nov-06 7:25
Clive Pottinger6-Nov-06 7:25 
AnswerRe: XML Deserialization question Pin
Clive Pottinger6-Nov-06 7:52
Clive Pottinger6-Nov-06 7:52 
GeneralRe: XML Deserialization question Pin
S. Senthil Kumar7-Nov-06 5:30
S. Senthil Kumar7-Nov-06 5:30 
AnswerRe: XML Deserialization question Pin
Clive Pottinger8-Nov-06 15:10
Clive Pottinger8-Nov-06 15:10 

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.