感叹号(!)运算符用于 vb.net 中的数字,这是做什么的? [英] Exclamation(!) operator used on a number in vb.net, what does this do?
问题描述
我正在查看继承的代码,我在 vb.net windows 窗体中发现了这个:
I'm looking at inherited code and I found this in a vb.net windows form:
New System.Drawing.SizeF(6.0!, 13.0!)
我的问题是,!
(感叹号)运算符在这里的意义是什么?我对感叹号运算符的大部分搜索最终都会返回记录集格式,或者 !
在搜索中被忽略,我得到了数百个不相关的项目.
My question is, what is the significance of the !
(exclamation) operator here? Most of my searching for the exclamation operator ends up returning recordset format or the !
gets ignored in the search and I get hundreds of unrelated items.
推荐答案
强制文字为 Single.
It's to force the literal to be a Single.
Visual Basic 支持类型字符:
Visual Basic supports Type Characters:
除了在声明语句中指定数据类型外,您还可以使用类型字符强制某些编程元素的数据类型.类型字符必须紧跟在元素之后,中间不能有任何类型的字符.
In addition to specifying a data type in a declaration statement, you can force the data type of some programming elements with a type character. The type character must immediately follow the element, with no intervening characters of any kind.
和:
文字也可以使用标识符类型字符(%、&、@、!、#、$),变量、常量和表达式也可以.但是,文字类型字符(S、I、L、D、F、R、C)只能与文字一起使用.
Literals can also use the identifier type characters (%, &, @, !, #, $), as can variables, constants, and expressions. However, the literal type characters (S, I, L, D, F, R, C) can be used only with literals.
这篇关于感叹号(!)运算符用于 vb.net 中的数字,这是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!