VB.NET打开选项严格关闭直列 [英] VB.NET Turning Option Strict Off In-Line

查看:136
本文介绍了VB.NET打开选项严格关闭直列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法把选项严格关闭的code只是一个单一的线?

Is there a way to turn option strict off for just a single line of code?

我做一些维护工作,我需要一个地方来欺骗,我不希望降低整个文件的标准。

I'm doing some maintenance work and I need to "cheat" in just one place and I don't want to lower the standard for the entire file.

推荐答案

可悲的是,这是不可能为code在文件中的一行。请参阅 MSDN文档

Sadly, it is not possible for a single line of code in a file. See the MSDN docs.

在另一方面,你很可能使你的单codeA独立的功能线,把在上一个文件一个新的文件,部分类的属性,并把选项严格关闭。该IL编译器可能会内联你的函数,无论如何,所以这将是等同speedwise,但会很丑从实用的角度出发。

On the other hand, you could probably make your single line of code a separate function, put that in a new file with partial class attributes, and put Option Strict Off on that one file. The IL compiler will probably inline your function anyway, so it will be equivalent speedwise, but will be ugly from a practical point of view.

这篇关于VB.NET打开选项严格关闭直列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆