Hi My Code Masters,
Trust you all are doing just fine.
Please I want to get the Values of this Element ART from my XML files if the vale is ART i will then count Regimen else i will not. so i use this code
- int RegimenCounter = 0;
- string result = "";
- if(!string.IsNullOrEmpty(result=xd.Descendants("PrescribedRegimenTypeCode").Single().Value))
- {
- if (result == "ART")
- {
- RegimenCounter = xd.Descendants("Regimen").Count();
- }
- }
when i execute the code i am getting an exception error "Sequence Contain no Element". it because the first XML file does not contain that Element "PrescribedRegimenTypeCode" while other files have in them.
please i need your help to resolve this challenge.
thank you

Abraham OlatubosunPosted Nov 24, 2016, 3:32 PM
Object reference not set to an instance of an object
what do i do in issue like this, i suggest i will need to check first if that Element is present but how can i do that please i need any help as 9 am of 25th of Nov 2016 is my deadlineManas MohapatraPosted Nov 24, 2016, 1:59 PM
Nitin SontakkePosted Nov 24, 2016, 10:49 AM
Abraham OlatubosunPosted Nov 24, 2016, 6:15 AM
Nitin SontakkePosted Nov 24, 2016, 5:54 AM