×

VB.Net基本教程

VB.Net 环境设置VB.Net 程序结构VB.Net 基本语法VB.Net 数据类型VB.Net 变量VB.Net 常数和枚举VB.Net 修饰符VB.Net 声明VB.Net 指令VB.Net 运算符VB.Net 决策VB.Net 循环VB.Net 字符串VB.Net 日期和时间VB.Net 数组VB.Net 集合VB.Net 函数VB.Net Sub过程(子程序)VB.Net 类与对象VB.Net 异常处理VB.Net 文件处理VB.Net 基本控制VB.Net 对话框VB.Net 高级表单VB.Net 事件处理

VB.Net 高级教程

VB.Net 正则表达式VB.Net 数据库访问VB.Net Excel工作表VB.Net 发送邮件VB.Net XML处理VB.Net Web编程

VB.Net 有用的资源

VB.Net 有用资源

VB.Net 其他操作符


VB.Net  运算符VB.Net 运算符


有很少其他重要的操作系统支持VB.Net。

运算符 描述 示例
AddressOf Returns the address of a procedure.
返回过程的地址。
AddHandler Button1.Click,
AddressOf Button1_Click
Await It is applied to an operand in an asynchronous method or lambda expression to suspend execution of the method until the awaited task completes.
它应用于异步方法或lambda表达式中的操作数,以挂起该方法的执行,直到等待的任务完成。
 
Dim result As res
= Await AsyncMethodThatReturnsResult()
Await AsyncMethod()
GetType It returns a Type object for the specified type. The Type object provides information about the type such as its properties, methods, and events.
它返回指定类型的Type对象。 Type对象提供有关类型的信息,例如其属性,方法和事件。
MsgBox(GetType(Integer).ToString())
Function Expression It declares the parameters and code that define a function lambda expression.
它声明定义函数lambda表达式的参数和代码。
Dim add5 = Function(num As
 Integer) num + 5
'prints 10
Console.WriteLine(add5(5))
If It uses short-circuit evaluation to conditionally return one of two values. The If operator can be called with three arguments or with two arguments.
它使用短路评估有条件地返回两个值之一。 可以使用三个参数或两个参数调用If运算符。
Dim num = 5
Console.WriteLine(If(num >= 0,
"Positive", "Negative"))

示例:

以下示例演示了其中一些运算符:
Module assignment
   Sub Main()
      Dim a As Integer = 21
      Console.WriteLine(GetType(Integer).ToString())
      Console.WriteLine(GetType(Double).ToString())
      Console.WriteLine(GetType(String).ToString())
      Dim multiplywith5 = Function(num As Integer) num * 5
      Console.WriteLine(multiplywith5(5))
      Console.WriteLine(If(a >= 0, "Positive", "Negative"))
      Console.ReadLine()
   End Sub
End Module

当上述代码被编译和执行时,它产生以下结果:
System.Int32
System.Double
System.String
25
Positive


VB.Net  运算符VB.Net 运算符


分类导航

关注微信下载离线手册

bootwiki移动版 bootwiki
(群号:472910771)