The XML literal support is the second thing I have seen special in Visual Basic which is really amazing.The first feature was the support for multiple indexer properties .XML literals helps us to create XElement by just writing plain XML in the VB.net code.This simple definition will not help anybody to learn what is XMl literals and their importance in dealing with xml.So let’s consider an example of XML serialization.
I have a class say Employee with 2 properties Name as string and ID as integer.The requirement is to get a XML representation of the employee collection.
If I pass a list of employee class I need out put like.
Here is the traditional code.
Look at the code which uses XML literals.
I don’t think I need to explain anything further about the advantages.If you are a ASP.Net developer you might already understood the use of “<%= %>”