Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
992 views
in Technique[技术] by (71.8m points)

.net - VB.NET Turning Option Strict Off In-Line

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...