vb.net 中 float[] 的等效数据类型是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33693481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 19:33:47  来源:igfitidea点击:

What is equivalent data type of float[ ] in vb.net?

c#vb.nettype-conversion

提问by Uroosa

What is the vb.net equivalent statement of following code?

以下代码的 vb.net 等效语句是什么?

`float[] widths = new float[] { 1f, 1f, 1f };` 

回答by Uroosa

Dim widths() as Single = {1.0f, 1.0f, 1.0f}

Dim widths() as Single = {1.0f, 1.0f, 1.0f}

(http://msdn.microsoft.com/en-us/library/y13tek7e.aspx)

( http://msdn.microsoft.com/en-us/library/y13tek7e.aspx)

回答by Croll

floattype accessed with name Singlein Visual Basic. floatis Visual C# keyword only.

floatSingle在 Visual Basic 中使用名称访问的类型。float仅是 Visual C# 关键字。

Define an arrayof System.Single.

定义数组System.Single

回答by Rahul Tripathi

You can try to use Single

您可以尝试使用Single

Dim widths() as Single = {1.0f, 1.0f, 1.0f}

Use the Single data type to contain floating-point values that do not require the full data width of Double. In some cases the common language runtime might be able to pack your Single variables closely together and save memory consumption.

使用 Single 数据类型来包含不需要 Double 的完整数据宽度的浮点值。在某些情况下,公共语言运行时可能能够将您的 Single 变量紧密地打包在一起并节省内存消耗。