A = B = 5在VB.NET - 是不可能的? [英] a = b = 5 in VB.NET - impossible?

查看:168
本文介绍了A = B = 5在VB.NET - 是不可能的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在VB.NET做 A = B = 5 ? (我知道, = 是一个比较操作符太)

我的意思做的不可以结果(如果B = 2用例)

  A = FALSE
B = 2
 

如何做到这一点,但是,在这样的情况下波纹管?


在不方便在我的code导致此问题:有些对象 A,B,..ž由参的方法传递,如果我不初始化它们的编译器警告我说,这shoudl进行初始化(=由如没有)

 暗淡A,B,C,D,Z作为GraphicsPath的'=没有什么是不可能的,只能各部分
DrawPaths(A,B,C,D,z)的'DrawPaths设置一个新的= GraphicPath()等。
 

解决方案

A = B = 5 方法

 如果B = 5则a = TRUE,否则A =假
 

如果您希望将值5分配给和到B的同时,必须在单独的行添加:

  B = 5
A = B
 

您也可以把它们写在同一行,但使用vb.net行分隔符:

  B = 5:A = B
 

Is it possible in VB.NET doing a = b = 5? (I know that = is a comparison operator too)

I mean do not result (if b = 2 by e.g.)

a = false
b = 2

HOW to do it, however, in situations like bellow?


The inconvenient caused this question in my code: some objects a, b, .. z are passed by ref in a method, if I don't initialize them compiler warns me that it shoudl be initialized(= Nothing by e.g.)

Dim a, b, c, d, z As GraphicsPath ' = Nothing is impossible, only each a part
DrawPaths(a, b, c, d, z)          ' DrawPaths sets a = new GraphicPath() etc. 

解决方案

a = b = 5 means

if b = 5 then a = true else a = false

if you want to assign the value 5 to a and to b at the same time, you must add it on a separate line :

b = 5
a = b

you can also write them on the same line but using the vb.net line separator :

b = 5 : a = b

这篇关于A = B = 5在VB.NET - 是不可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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