SoFunction
Updated on 2025-03-07

C# Linq to read an instance of XML file


class Program
    {
        static void Main(string[] args)
        {
            XDocument doc = ("");
var text = from t in ("conf") //Locate to node
.Where(w => ("to").('@'))   //If you want to filter, use this statement
                       select new
                       {
                           to = ("to").Value,
                           froms = ("from").Value,
                           head = ("heading").Value,
                           body = ("body").Value,
title = ("title").Attribute("name").Value   //Note that attribute is used here
                       };
            foreach (var a in text)
            {
                ();
                ();
                ();
                ();
                ();
            }
            ();
        }
    }