开发者

using VB.Net And/Or operators for logical short-circuiting: Any compiler-directive/workaround?

I found using AndAlso/OrElse, all the time, VERY annoying. It reduces code readability, especially when condit开发者_C百科ioning get complicated.

Any suggestions?


I'm fairly sure there's no (supported) way to change the meaning of And/Or, and assuming that your code might in the future be maintained or read by other people it would be a very bad idea, you'd confuse them completely.

If conditioning gets too complicated I'd suggest instead splitting it up on multiple lines.
so instead of:

If x AndAlso y AndAlso (z Or w) Then

Make it something like:

xy = x AndAlso y
zw = z Or w
if xy AndAlso zw Then
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜