问题描述
您好,我有一个问题,我希望有人可以为我澄清。我的问题
关于变量/数组变量的声明。无论如何,我是想知道是否有人可以向我解释以下声明:
Dim sendBytes as [Byte]()= Encoding.ASCII.GetBytes( 是否有人
正在听...)
看起来类型字节是一个数组。它是否正确?另外,
括号代表什么?我尝试找到某种解释但是
不成功。以下语法是否可以替代?
Dim sendBytes as Byte()= Encoding.ASCII.GetBytes(有人在听......)
谢谢,
-
TC
Hello, I have a question I''m hoping someone can clarify for me. My question
regards the declaration of a variable/ array variable. Anyhow, I was
wondering if someone can explain the following declaration to me:
Dim sendBytes as [Byte]( ) = Encoding.ASCII.GetBytes("Is anybody
listening...")
It looks like type byte is an array. Is this correct? Also, what do the
brackets represent? I tried finding some type of explanation but is
unsuccessful. Would the following syntax be an alternative?
Dim sendBytes as Byte( ) = Encoding.ASCII.GetBytes("Is anybody listening...")
Thanks,
--
TC
推荐答案
在VB中的标识符周围放置方括号可以让你使用
VB保留字作为变量名。你提供的例子并不是
真的需要它们。这是一个例子:
Dim [String] As String =" Hello World"
MsgBox([String])
Putting square brackets around an identifier in VB allows you to use a
VB reserved word as a variable name. The example you provided does not
really need them. Here''s an example:
Dim [String] As String = "Hello World"
MsgBox([String])
这篇关于寻找关于声明语法的解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!