option-infer

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

安稳与你 提交于 2019-11-28 13:24:27
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? 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. Option Strict can be used

Best Practices: Option Infer [closed]

拟墨画扇 提交于 2019-11-28 09:42:08
What do you feel are best practices for the use of Option Infer in your projects? In Visual Studio 2008, Option Infer is a directive that allows the compiler to infer the datatype of a declared variable by looking at what is assigned to it. This is a key feature in VS2008 and is used extensively with LINQ statements and queries. However, turning on Option Infer may create pitfalls for future maintenance programmers. The type inference used by C# (and thus I presume other .net languages) is very precise (and excellent). The compiler will only allow the statement if the type is clear and

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

社会主义新天地 提交于 2019-11-27 07:39:26
问题 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? 回答1: 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

Best Practices: Option Infer [closed]

人盡茶涼 提交于 2019-11-27 03:07:38
问题 What do you feel are best practices for the use of Option Infer in your projects? In Visual Studio 2008, Option Infer is a directive that allows the compiler to infer the datatype of a declared variable by looking at what is assigned to it. This is a key feature in VS2008 and is used extensively with LINQ statements and queries. However, turning on Option Infer may create pitfalls for future maintenance programmers. 回答1: The type inference used by C# (and thus I presume other .net languages)