当前位置: 网站首页 > .NET > vb.net

VB.Net学习笔记(面向对象的基本数据类型)

时间:1970-1-1 08:33:31来源: vb.net作者:admin 点击:3次 字体 [ С]
这些基本类型也象类一样拥有各自的方法和属性,熟练运用它们能让你的程序更优雅和更有面向对象的味道。



基本类型的重要方法和属性举例

Dim i As Int32

Dim s As String

Dim ss() As String

Dim by As Byte

Dim d As Double

Dim b As Boolean

Dim da As Date

Dim c As Char

Dim cc() As Char



'整数操作

i = Int32.Parse("¥123", Globalization.NumberStyles.AllowCurrencySymbol) '123

i = Int32.MaxValue '2147483647

i = Int32.MinValue '-2147483648

by = Byte.Parse("1") '1

'浮点数操作

d = Double.PositiveInfinity '正无穷大

d = Double.Epsilon '4.94065645841247E-324

'布尔操作

s = Boolean.TrueString 'True

'日期操作

da = Date.MaxValue '9999-12-31 23:59:59

da = Date.MinValue '0:00:00

da = Date.Now '2004-5-7 13:17:35

b = Date.IsLeapYear(2004) 'True

i = Date.DaysInMonth(2004, 5) '31

'以下方法用于判断字符的特性

Char.IsControl(c)

Char.IsDigit(c)

Char.IsLetter(c)

Char.IsLetterOrDigit(c)

Char.IsLower(c)

Char.IsNumber(c)

Char.IsPunctuation(c)

Char.IsSeparator(c)
发表评论
验证码:
最新评论
相关文章
最热文章