Biml with VB is getting easier with Option Explict/Strict!

Biml with VB is getting easier with Option Explict/Strict!

Diesen Artikel finden Sie hier auch in deutscher Sprache.

With the latest release of Biml, using Visual Basic as your prefered language is getting even easier again!

Previously, you had to declare any kind of variable and object type (instead of just using something like "var" in C#):

<#@template Language="VB" #>
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<# for n as integer = 1 to 25 #>
    <Package Name="MyAutomatedBiml<#= n #>"/>
<# next#>
</Packages>
</Biml>

That was true even for the most simple cases like for n as integer = 1 to 25 instead of just for n = 1 to 25, even though it is clear that his can never be anything else in this context.

Now, you can use two new attributes in the template definition: optionexplicit and/or optionstrict:

<#@template Language="VB" optionexplicit="false" optionstrict="false" #>
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<# for n = 1 to 25 #>
    <Package Name="MyAutomatedBiml<#= n #>"/>
<# next#>
</Packages>
</Biml>

You can find more details on the effect of those options to the VB Compiler here:
Option Explicit
Option Strict

This has two great advantages:

1. Readability
You’re getting rid of a lot of clutter in your code!

2. Getting to know Biml
Previously, you had to know all the object types etc. which was hard for beginners. Now, instead of doing something like

Dim TBL AS AstTableNode = RootNode.Tables(0)

you can just do:

TBL = RootNode.Tables(0)

Any questions or comments? We’d love to hear from you at biml@solisyon.de!

Further Information on Biml in English can be found on our English Biml Page.

Happy Biml’ing!

Facebook