VB.NET 9 XML Literals
Feb. 23rd, 2009 03:33 pmSo for our current project, we're working in VB.NET 9.0 - I won't go into our methodology or reasons for switching. That said, I've found that I'm not a huge fan of the language so far. It literally feels more difficult to express myself in than C#. While I acknowledge that this could well be because of the learning curve any new language involves, I find myself yearning for semi-colons and curly braces.
That said - the single thing I've found so far that VB.NET does better than C# is building web server controls in ASP.NET. This is because of the feature that, when I first read about it, I shunned - XML Literals. What this is is the ability to express XML documents or fragments in VB.NET directly, without having to go through the XML object models that the .NET framework provides.
I'll admit - when I first saw this feature, I chuckled a little to myself and then moved on. We had, after all, done this before - ASP was all about this sort of embedded code. Also, I couldn't see why I would want to create XML documents like that in the middle of my code. And, in most scenarios, I'm still reasonably sure I wouldn't. That said, why don't you tell me what you think the more readable code is:
( Code Here )
(Note that these two controls are doing two slightly different things, but they are close enough to illustrate my point)
That said - the single thing I've found so far that VB.NET does better than C# is building web server controls in ASP.NET. This is because of the feature that, when I first read about it, I shunned - XML Literals. What this is is the ability to express XML documents or fragments in VB.NET directly, without having to go through the XML object models that the .NET framework provides.
I'll admit - when I first saw this feature, I chuckled a little to myself and then moved on. We had, after all, done this before - ASP was all about this sort of embedded code. Also, I couldn't see why I would want to create XML documents like that in the middle of my code. And, in most scenarios, I'm still reasonably sure I wouldn't. That said, why don't you tell me what you think the more readable code is:
( Code Here )
(Note that these two controls are doing two slightly different things, but they are close enough to illustrate my point)