option-strict

What do Option Strict and Option Explicit do?

回眸只為那壹抹淺笑 提交于 2019-11-25 22:57:47
问题 I saw this post: Typos… Just use option strict and explicit please.. during one software development project, which I was on as a consultant, they were getting ridiculous amounts of errors everywhere… turned out the developer couldn’t spell and would declare variables with incorrect spelling.. no big deal, until you use the correct spelling when you’re assigning a value to it… and you had option explicit off. Ouch to them…\" What is Option Strict and Option Explicit anyway? I have googled it

VB.NET equivalent for C# 'dynamic' with Option Strict On

◇◆丶佛笑我妖孽 提交于 2019-11-25 22:37:33
Is there an equivalent for the C# 4 'dynamic' keyword when using type safe VB.NET, i.e. with Option Strict On ? The equivalent is Object in VB.NET but with Option Strict Off . With Option Strict On there's no equivalent. Put another way the dynamic keyword brings Option Strict Off equivalent functionality to C#. VB.NET always had the "dynamic" feature built in, originally called late binding. This syntax was supported forever: Dim obj = new SomeComClass() obj.DoSomething() Worked on code implemented in .NET and COM, the latter being the most common use. The dynamic keyword in C# gave it that