VB.Net/Language Basics/Data Type
Версия от 16:40, 26 мая 2010; (обсуждение)
A custom function to return inches from passed in centimeter value
Public Class MainClass
Private Function Inches(ByVal Cm As String)
Inches = Val(Cm) / 2.54
Inches = FormatNumber(Inches, 2)
Return Inches
End Function
End Class
Value type and Reference type
Public Class MainClass
Public Shared Sub Main()
"Value Types
Dim ptX As New System.Drawing.Point(10, 20)
Dim ptY As New System.Drawing.Point
ptY = ptX
ptX.X = 200
Console.WriteLine(ptY.ToString())
"Reference Types
Dim objX As New System.Text.StringBuilder("Hello World")
Dim objY As System.Text.StringBuilder
objY = objX
objX.Replace("World", "Test")
Console.WriteLine(objY.ToString())
End Sub
End Class