VB.NET 9.0: XML Literal

VB.NET 9.0: XML Literal

  • Comments 8

This is the one feature which can make VB.NET developers feel better than C# folks. I have seen people complaining about MS saying that MS has done lot for C# but not equally for VB.NET. One of the biggest was Refractoring. There are so many such. But this feature is just “SPELLBOUND” when I first experienced it.

 

Today, people handle XML from .NET in many ways. One approach is they simply concatenate the string to create XML string and end up writing to a file. Another is they generate DataSet/DataTable and uses WriteXml() method to write Xml to a file. More sophisticated way is to use System.Xml namespace and build Xml step by step in strongly typed manner. But this one is something which is simply amazing.

 

In Visual Studio 2008 if you write something using System.Xml.Linq

 

Dim _xml2 = New XElement("ProcessList", _

                New XElement("Process", _

                    New XAttribute("ThreadCount", "2"), "Some Process"))

 

You can also write,

 

Dim _xml = <Processes>

               <Process ThreadCount="2">Some Name</Process>

           </Processes>

 

 

These two statements are identical. Second one looks like an ASP.NET page but it is actually XElement object. But the feeling you will get as if you are writing an Xml in a XML Editor.

 

Coolest ever.

Today I found an article with very detailed discussion http://geekswithblogs.net/Silverlight2/archive/2008/03/30/xml-literals-and-embedded-expressions.aspx

 

Namoskar!!!

Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post
  • This is the one feature which can make VB.NET developers feel better than C# folks. I have seen people

  • I have discussed about the native XML support in VB.NET code editor in one of my BLOG posts. Now to generate

  • I have discussed about the native XML support in VB.NET code editor in one of my BLOG posts. Now to generate

  • While XML literal features in Visual Basic get all the love , the new XElement API for the CLR makes

  • While XML literal features in Visual Basic get all the love , the new XElement API for the CLR makes

  • Hi i am new in vb.net I want to convert xlsx file to xls  file using vb.net

    Can any one help me please........

  • i'm stuck making a alphanumeric pager I need to filter out my "glossary.xml" file by first letter of the "word" node can you help me do that?

    or how do I filter xml files via vb?

    thanks in advanced,

    jav

  • I do not understand about programming languages. but which I understand is getting a lot of friends going to get better: D

Page 1 of 1 (8 items)