Click here to Skip to main content
16,017,207 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using a .txt file as input from network folder Pin
Dave Kreskowiak9-Jul-14 12:20
mveDave Kreskowiak9-Jul-14 12:20 
GeneralRe: Using a .txt file as input from network folder Pin
CaptainJack68310-Jul-14 3:32
CaptainJack68310-Jul-14 3:32 
GeneralNeed Extension methods as mentioned below Pin
prasanna_durai9-Jul-14 7:09
prasanna_durai9-Jul-14 7:09 
GeneralRe: Need Extension methods as mentioned below Pin
Matt T Heffron9-Jul-14 7:38
professionalMatt T Heffron9-Jul-14 7:38 
GeneralRe: Need Extension methods as mentioned below Pin
OriginalGriff9-Jul-14 8:11
mveOriginalGriff9-Jul-14 8:11 
QuestionSplit tag xml in more file xml, with C# Pin
Federico Barbieri8-Jul-14 22:50
Federico Barbieri8-Jul-14 22:50 
SuggestionRe: Split tag xml in more file xml, with C# Pin
Richard MacCutchan8-Jul-14 23:20
mveRichard MacCutchan8-Jul-14 23:20 
AnswerRe: Split tag xml in more file xml, with C# Pin
Richard Deeming9-Jul-14 2:05
mveRichard Deeming9-Jul-14 2:05 
Linq to XML[^] makes this fairly simple:

C#
XDocument document = XDocument.Parse(@"<root>
    <Header>
        <B>
            <C></C>
            <D></D>
        </B>
    </Header>
    <Body>
        <F></F>
    </Body>
    <Body>
        <G></G>
    </Body>
    <Body>
        <H></H>
    </Body>
</root>");


XName rootName = document.Root.Name;
XDeclaration declaration = document.Declaration;
XElement header = document.Root.Element("Header");

IEnumerable<XDocument> newDocuments = document.Root.Elements("Body")
    .Select(body => new XDocument(
        declaration,
        new XElement(rootName,
            header,
            body
        )
    ));

foreach (XDocument newDocument in newDocuments)
{
    // Do something with the document:
    Console.WriteLine(newDocument);
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionAdding code to encrypt and decrypt text in textbox with C# 2008 Pin
KaKoten8-Jul-14 21:29
KaKoten8-Jul-14 21:29 
AnswerRe: Adding code to encrypt and decrypt text in textbox with C# 2008 Pin
OriginalGriff8-Jul-14 22:56
mveOriginalGriff8-Jul-14 22:56 
GeneralRe: Adding code to encrypt and decrypt text in textbox with C# 2008 Pin
KaKoten9-Jul-14 13:15
KaKoten9-Jul-14 13:15 
GeneralRe: Adding code to encrypt and decrypt text in textbox with C# 2008 Pin
OriginalGriff9-Jul-14 21:31
mveOriginalGriff9-Jul-14 21:31 
GeneralRe: Adding code to encrypt and decrypt text in textbox with C# 2008 Pin
KaKoten9-Jul-14 23:17
KaKoten9-Jul-14 23:17 
AnswerRe: Adding code to encrypt and decrypt text in textbox with C# 2008 Pin
Eddy Vluggen11-Jul-14 7:19
professionalEddy Vluggen11-Jul-14 7:19 
QuestionC# Questions Pin
shiftwik8-Jul-14 8:32
shiftwik8-Jul-14 8:32 
AnswerRe: C# Questions Pin
Eddy Vluggen8-Jul-14 8:48
professionalEddy Vluggen8-Jul-14 8:48 
GeneralRe: C# Questions Pin
shiftwik8-Jul-14 8:56
shiftwik8-Jul-14 8:56 
AnswerRe: C# Questions Pin
PIEBALDconsult8-Jul-14 9:08
mvePIEBALDconsult8-Jul-14 9:08 
AnswerRe: C# Questions PinPopular
Pete O'Hanlon8-Jul-14 9:19
mvePete O'Hanlon8-Jul-14 9:19 
GeneralRe: C# Questions Pin
Richard Andrew x648-Jul-14 11:00
professionalRichard Andrew x648-Jul-14 11:00 
GeneralRe: C# Questions Pin
Pete O'Hanlon8-Jul-14 11:16
mvePete O'Hanlon8-Jul-14 11:16 
GeneralRe: C# Questions Pin
shiftwik8-Jul-14 21:10
shiftwik8-Jul-14 21:10 
AnswerRe: C# Questions Pin
OriginalGriff8-Jul-14 9:32
mveOriginalGriff8-Jul-14 9:32 
GeneralRe: C# Questions Pin
shiftwik8-Jul-14 21:09
shiftwik8-Jul-14 21:09 
GeneralRe: C# Questions Pin
OriginalGriff8-Jul-14 21:21
mveOriginalGriff8-Jul-14 21:21 

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.