RANT:选项严格等 [英] RANT: option strict etc

查看:89
本文介绍了RANT:选项严格等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我第一次开始使用.net(beta 1)时,我遇到了严格的选项和

认为这可能真的很好,从那以后总是把它转过来
$ b $在这里,大多数人似乎都同意这是一件好事。


i现在被要求调试vb2005网络应用程序3周而且没有

提到了严格的选项,(也没有定义类,只有几个结构)一切都被定义为''作为对象'',数据回来了
来自数据库调用的
是''Object'',附加一个字符串使其成为有效的

字符串...


尝试调试这个噩梦比我想象的还要糟糕


所以,如果你曾试图将期权严格关闭,请先考虑自杀


解决方案

Guy,


你怎么知道Jon Vaughan会在25分钟左右发送消息

船尾呃你这个消息可能是他必须要思考的东西。


我认为你完全正确。如果需要进行一些建模或测试,可以选择严格禁用




Cor


" guy" < gu*@discussions.microsoft.com> schreef在bericht

新闻:3C ********************************** @ microsof t.com ...

当我第一次开始使用.net(beta 1)时,我遇到了严格的选项,并且认为这可能非常好,从那以后总是转向<这个大多数人似乎都同意这是一件好事。

我现在被要求调试一个vb2005网络应用程序3周,并且有
没有
提到选项严格,(也没有定义类,只有几个结构)一切都被定义为''作为对象'',数据来回

从数据库调用是''对象'',附加一个字符串使其成为一个有效的字符串...

试图调试这个噩梦更糟糕比我想象的那样

所以,如果你有诱惑将选项严格关闭请首先考虑
自杀



我不确定但是它也应该是开启的默认情况下 - 当您创建一个新的

项目时,也应该很难找到将其关闭的项目。事实上,

有铸造(DirectCast,CType),我看不出任何理由让它完全可以选择
。只有一个案例,我可以想到我需要切换它的地方

off,这是一些Interop的解决方法。我设法找到一个

更好的解决方法,不需要关闭稍后。


这只是普通的懒惰导致人们像这样编码。

" Cor Ligthert [MVP]" <无************ @ planet.nl>在消息中写道

新闻:eH ************** @ TK2MSFTNGP02.phx.gbl ...

盖伊,
你怎么知道Jon Vaughan会在你发出大约25分钟后发出一条消息,因为这个消息可能是他必须要反思的。

你是完全正确的我的看法。只有在需要进行某些建模或测试的情况下才能使用严格选项。



< gu*@discussions.microsoft.com> schreef in bericht
新闻:3C ********************************** @ microsof t.com。 ..

当我第一次开始使用.net(测试版1)时,我遇到了严格的选项,并且认为这可能真的很好,从那以后总是转向

,这里的大多数人似乎都同意这是一件好事。

我现在被要求调试一个vb2005网络应用程序3周,并且有
没有<提到选项严格,(也没有定义类,只是
几个结构)一切都被定义为''作为对象'',数据来回

从数据库调用是''对象'',附加一个字符串使其成为一个有效的字符串...

试图调试这个噩梦更糟糕比我想象的那样

所以,如果你有诱惑将选项严格关闭请首先考虑
自杀




R. MT,


默认情况下它是关闭的,因为期望(并且可能看到这个

新闻组)开发人员从VB6升级到VBNet 2005.

代码上只会出现一堆错误。


实际上在升级中没有任何改变的绑定方式

被处理。它是晚期绑定。它的运行速度仍然比C#更低,而且更像是VB6。但是更像是VB6。


VBNet与选项Strict在运行时的速度与C#相同/>

Cor


" RMT" <无**** @ nospam.com> schreef在bericht

新闻:e6 ******************* @ news.demon.co.uk ...

我不确定,但它也应该开启。默认情况下 - 当您创建一个新的项目时,也很难找到将其关闭的项目。事实上,在使用强制转换(DirectCast,CType)时,我看不出任何使其成为可选的任何理由。只有一个案例,我可以想到我需要切换到哪里,这是一些Interop的解决方法。我设法找到一个不需要关闭的更好的解决方法。后来。

只是简单的懒惰导致人们像这样编码。

" Cor Ligthert [MVP]" <无************ @ planet.nl>在消息中写道
新闻:eH ************** @ TK2MSFTNGP02.phx.gbl ...

盖伊,
你怎么知道Jon Vaughan会在你发出大约25分钟后发出一条消息,因为这个消息可能是他必须要反思的。

在我看来你是完全正确的。只有在需要进行某些建模或测试的情况下才能使用严格选项。



< gu*@discussions.microsoft.com> schreef in bericht
新闻:3C ********************************** @ microsof t.com。 ..

当我第一次开始使用.net(测试版1)时,我遇到了严格的选项,并且认为这可能真的很好,从那以后总是转向

,这里的大多数人似乎都同意这是一件好事。

我现在被要求调试一个vb2005网络应用程序3周,并且有
没有<提到选项严格,(也没有定义类,只是
几个结构)一切都被定义为''作为对象'',数据来回

从数据库调用是''对象'',附加一个字符串使其成为一个有效的字符串...

试图调试这个噩梦更糟糕比我想象的那样

所以,如果你有诱惑将选项严格关闭请首先考虑
自杀





when i first started using .net (beta 1) i came across option strict and
thought hey this could be really good, and since then have always turned it
on, most people here seem to agree that this is a good thing.

i have now been asked to debug a vb2005 web app for 3 weeks and there is no
mention of option strict in it, (there are also no classes defined, just a
couple of structures) everything is define as ''as object'', data coming back
from a database call is ''Object'' with a string appended to make it a valid
string ...

trying to debug this nightmare is worse than i could possibly imagine

so if you ever are tempted to turn option strict off please consider suicide
first!

解决方案

Guy,

How did you know that Jon Vaughan would sent a message about 25 minutes
after you for which this message can maybe something he has to overthink.

You are completely right in my opinion. Option strict off should only be
used in cases where there is some modeling or testing to be done.

Cor

"guy" <gu*@discussions.microsoft.com> schreef in bericht
news:3C**********************************@microsof t.com...

when i first started using .net (beta 1) i came across option strict and
thought hey this could be really good, and since then have always turned
it
on, most people here seem to agree that this is a good thing.

i have now been asked to debug a vb2005 web app for 3 weeks and there is
no
mention of option strict in it, (there are also no classes defined, just a
couple of structures) everything is define as ''as object'', data coming
back
from a database call is ''Object'' with a string appended to make it a
valid
string ...

trying to debug this nightmare is worse than i could possibly imagine

so if you ever are tempted to turn option strict off please consider
suicide
first!



I''m not sure but also it should be "on" by default - when you create a new
project and it should also be difficult to find to switch it off. In fact,
with casting (DirectCast, CType), I can''t see ANY reason for making it
optional at all. Only one case I can think of where I needed to switch it
off and that was a workaround for some Interop stuff. I managed to find a
better workaround that didn''t require "off" later on.

It''s just plain laziness that leads people to code like this.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...

Guy,

How did you know that Jon Vaughan would sent a message about 25 minutes
after you for which this message can maybe something he has to overthink.

You are completely right in my opinion. Option strict off should only be
used in cases where there is some modeling or testing to be done.

Cor

"guy" <gu*@discussions.microsoft.com> schreef in bericht
news:3C**********************************@microsof t.com...

when i first started using .net (beta 1) i came across option strict and
thought hey this could be really good, and since then have always turned
it
on, most people here seem to agree that this is a good thing.

i have now been asked to debug a vb2005 web app for 3 weeks and there is
no
mention of option strict in it, (there are also no classes defined, just
a
couple of structures) everything is define as ''as object'', data coming
back
from a database call is ''Object'' with a string appended to make it a
valid
string ...

trying to debug this nightmare is worse than i could possibly imagine

so if you ever are tempted to turn option strict off please consider
suicide
first!




RMT,

It is just off by default because the expected (and probably is seeing this
newsgroup) developers upgrading from VB6 to VBNet 2005. With option strict
on the code would have been only a bunch of errors.

In fact there is in that upgrade than nothing changed in the way the binding
is handled. It is late binding. It runs than still at a speed not comparable
with C# but more like VB6.

VBNet with option Strict on runs at the same speed as C#

Cor

"RMT" <no****@nospam.com> schreef in bericht
news:e6*******************@news.demon.co.uk...

I''m not sure but also it should be "on" by default - when you create a new
project and it should also be difficult to find to switch it off. In
fact, with casting (DirectCast, CType), I can''t see ANY reason for making
it optional at all. Only one case I can think of where I needed to switch
it off and that was a workaround for some Interop stuff. I managed to
find a better workaround that didn''t require "off" later on.

It''s just plain laziness that leads people to code like this.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...

Guy,

How did you know that Jon Vaughan would sent a message about 25 minutes
after you for which this message can maybe something he has to overthink.

You are completely right in my opinion. Option strict off should only be
used in cases where there is some modeling or testing to be done.

Cor

"guy" <gu*@discussions.microsoft.com> schreef in bericht
news:3C**********************************@microsof t.com...

when i first started using .net (beta 1) i came across option strict and
thought hey this could be really good, and since then have always turned
it
on, most people here seem to agree that this is a good thing.

i have now been asked to debug a vb2005 web app for 3 weeks and there is
no
mention of option strict in it, (there are also no classes defined, just
a
couple of structures) everything is define as ''as object'', data coming
back
from a database call is ''Object'' with a string appended to make it a
valid
string ...

trying to debug this nightmare is worse than i could possibly imagine

so if you ever are tempted to turn option strict off please consider
suicide
first!





这篇关于RANT:选项严格等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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