什么是VB.net中的:= [英] What is := in VB.net
本文介绍了什么是VB.net中的:=的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,主题告诉了一切...
我找不到VB.NET中的:=功能...
这里是一个示例...
SwitchDesktop(hDesktop:= p_lngHwnd)
有人可以告诉我吗?
谢谢:)
Well, subject tells everything ...
I can''t find what := does in VB.NET ...
Here''s one example ...
SwitchDesktop(hDesktop:=p_lngHwnd)
Can anyone tell me ?
thanks :)
推荐答案
它"表示命名参数.例如:
It''s for named parameters. For example:
<br />Sub ShowMsg(ByVal a as String, ByVal b as String, ByVal c as String)<br /> MsgBox(a & b & c)<br />End Sub<br /><br />Sub Main()<br /> ''Notice how a, b, and c are out of order.<br /> ShowMsg(c := "!", b := " World", a := "Hello")<br />End Sub<br />
除非我弄错了,否则:=允许您按名称和位置传递变量(下面的示例是徒手的).
示例子:子测试(byval Value1作为字符串,byval Value2作为整数,byval Value3作为对象)
按位置调用的常规方法:调用sub test("value1",2,新对象)
按名称调用:调用子测试(Value3:=新对象,Value2:= 2,Value3:="doh!")
通常,您会看到:=在属性中使用.
Unless I am mistaken, := allows you to pass variables by name vs. by position (example below is freehand).
Example sub: sub test (byval Value1 as string, byval Value2 as integer, byval Value3 as object)
Normal way to call by position: Call sub test("value1", 2, new object)
call by name: Call sub test(Value3:= New object, Value2:=2, Value3:="doh!")
Generally you see the := used in attributes.
这篇关于什么是VB.net中的:=的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文