Value type and Reference type : Data Type « Data Types « VB.Net






Value type and Reference type

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


           
         
    
  








Related examples in the same category

1.A custom function to return inches from passed in centimeter value
2.Compare two boolean values
3.Compare two Byte values
4.Compare two Int16 numbers
5.Compare two Int32 values
6.Compare two Int64 values
7.Compare two Decimal values
8.Compare two Single values
9.Compare two Double values
10.Compare two Char values
11.Compare two string values
12.Compare two DateTime values
13.Compare two TimeSpan values
14.Compare two Version values