Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Painfully Slow Operation Pin
Dave Kreskowiak23-Jan-14 7:48
mveDave Kreskowiak23-Jan-14 7:48 
GeneralRe: Painfully Slow Operation Pin
eddieangel23-Jan-14 7:59
eddieangel23-Jan-14 7:59 
QuestionRead XML values (attributes and elements) with C# Pin
SJR_122-Jan-14 5:14
SJR_122-Jan-14 5:14 
AnswerRe: Read XML values (attributes and elements) with C# Pin
Christian Wulff22-Jan-14 23:38
Christian Wulff22-Jan-14 23:38 
GeneralRe: Read XML values (attributes and elements) with C# Pin
SJR_123-Jan-14 4:59
SJR_123-Jan-14 4:59 
GeneralRe: Read XML values (attributes and elements) with C# Pin
Christian Wulff23-Jan-14 5:06
Christian Wulff23-Jan-14 5:06 
GeneralRe: Read XML values (attributes and elements) with C# Pin
SJR_123-Jan-14 5:33
SJR_123-Jan-14 5:33 
GeneralRe: Read XML values (attributes and elements) with C# Pin
Christian Wulff23-Jan-14 7:44
Christian Wulff23-Jan-14 7:44 
Try that one, joining with subItems and adding a null item in the case that no subitem exists:

C#
public void Today3()
{
    XDocument xDoc = XDocument.Load(@"C:\Results\XMLTry.xml");
    var q = from homeItem in xDoc.Descendants("HomeItem")
	    from subItem in homeItem.Element("Item").Descendants("ItemNumber").Any () ? homeItem.Element("Item").Descendants("ItemNumber") : new List<XElement>(){null}
            select new
            {
                Description=(string)homeItem.Element("Description"),
                Time = (string)homeItem.Element("Time"),
                Id=(int)homeItem.Attribute("id"),
		ItemId = subItem == null ? "" : (string)subItem.Attribute("id"),
		Name = subItem == null ? "" : (string)subItem.Element("Name"),
		ItemDescrip = subItem == null ? "" : (string)subItem.Element("ItemDescrip")
            };
 
            foreach (var item in q)
                Console.WriteLine(@"Description = {0}
Time = {1}
Id = {2}
ItemId = {3}
Name = {4}
ItemDescrip = {5}
--------------", item.Description, item.Time, item.Id, item.ItemId, item.Name, item.ItemDescrip);
}

GeneralRe: Read XML values (attributes and elements) with C# Pin
SJR_123-Jan-14 9:03
SJR_123-Jan-14 9:03 
QuestionWindows Process and MEF Pin
Member 1027274822-Jan-14 3:13
Member 1027274822-Jan-14 3:13 
AnswerRe: Windows Process and MEF Pin
Eddy Vluggen22-Jan-14 8:28
professionalEddy Vluggen22-Jan-14 8:28 
AnswerRe: Windows Process and MEF Pin
Ron Beyer22-Jan-14 8:40
professionalRon Beyer22-Jan-14 8:40 
Questionexecuting rake from C# app Pin
lune1221-Jan-14 22:44
lune1221-Jan-14 22:44 
AnswerRe: executing rake from C# app Pin
Pete O'Hanlon21-Jan-14 23:02
mvePete O'Hanlon21-Jan-14 23:02 
GeneralRe: executing rake from C# app Pin
lune1222-Jan-14 0:33
lune1222-Jan-14 0:33 
GeneralRe: executing rake from C# app Pin
Pete O'Hanlon22-Jan-14 0:35
mvePete O'Hanlon22-Jan-14 0:35 
GeneralRe: executing rake from C# app Pin
lune1222-Jan-14 0:51
lune1222-Jan-14 0:51 
GeneralRe: executing rake from C# app Pin
Pete O'Hanlon22-Jan-14 0:57
mvePete O'Hanlon22-Jan-14 0:57 
AnswerRe: executing rake from C# app Pin
Bernhard Hiller22-Jan-14 20:34
Bernhard Hiller22-Jan-14 20:34 
QuestionError in DataGridView Filter Pin
a-erfani21-Jan-14 22:18
a-erfani21-Jan-14 22:18 
QuestionRe: Error in DataGridView Filter Pin
Richard MacCutchan21-Jan-14 23:20
mveRichard MacCutchan21-Jan-14 23:20 
AnswerRe: Error in DataGridView Filter Pin
a-erfani22-Jan-14 5:19
a-erfani22-Jan-14 5:19 
GeneralRe: Error in DataGridView Filter Pin
Richard MacCutchan22-Jan-14 5:25
mveRichard MacCutchan22-Jan-14 5:25 
GeneralRe: Error in DataGridView Filter Pin
a-erfani22-Jan-14 5:29
a-erfani22-Jan-14 5:29 
GeneralRe: Error in DataGridView Filter Pin
Richard MacCutchan22-Jan-14 5:36
mveRichard MacCutchan22-Jan-14 5:36 

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.