Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to mix VB.NET's Option Strict and the new Option Infer directives?

In a related question, my team is about to (hopefully) start using LINQ, and I'd like to take advantage of anonymous types. What is the best way to mix VB.NET's Option Strict (which we've been using through the life of the project) and the new Option Infer directives?

like image 871
Bob King Avatar asked Oct 11 '08 16:10

Bob King


1 Answers

Option Strict and Option Infer do not conflict, so I see no harm in having both on.

As a style guide, I prefer to put Option Strict, Explicit, and Infer at the top of each class file - this prevents differences in project or IDE settings from causing issues, and makes it clear what settings are used.

like image 93
Mark Brackett Avatar answered Sep 21 '22 02:09

Mark Brackett