Swap two integers without using a third : Integer « Data Type « VB.Net Tutorial






Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Collections
Public Class Tester
    Public Shared Sub Main
        
        Dim firstValue As Integer
        Dim secondValue As Integer

        firstValue = 17
        secondValue = 123
        Console.WriteLine("Before swap: {0}, {1}",firstValue, secondValue)

        firstValue = firstValue Xor secondValue
        secondValue = firstValue Xor secondValue
        firstValue = firstValue Xor secondValue
        Console.WriteLine("After swap: {0}, {1}",firstValue, secondValue)
    End Sub
End Class
Before swap: 17, 123
After swap: 123, 17








2.2.Integer
2.2.1.Define Integer variable and assign value
2.2.2.Add two integers together
2.2.3.Integer calculation
2.2.4.Swap two integers without using a third
2.2.5.MinValue and MaxValue of Integer
2.2.6.Parse Integer
2.2.7.Integer.GetType
2.2.8.Integer boolean calculation: Or, And, Xor, Not
2.2.9.Parse Integer variable and get hash code from Integer
2.2.10.Use Integer.CompareTo to compare two integers
2.2.11.Integer format: D10
2.2.12.Pass Integer to a function by reference
2.2.13.Pass Integer to a function by value
2.2.14.Compare Integer value in If statement
2.2.15.Integer OverflowException
2.2.16.Implicit conversion of an integer to a string
2.2.17.Explicit conversion of an integer to a string