VB.Net/Language Basics/Data Type

Материал из VB Эксперт
Перейти к: навигация, поиск

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
        "Reference Types
        Dim objX As New System.Text.StringBuilder("Hello World")
        Dim objY As System.Text.StringBuilder
        objY = objX
        objX.Replace("World", "Test")
   End Sub
End Class