DirectCast : DirectCast « Development « VB.Net Tutorial






public class Test
   public Shared Sub Main
        Dim numberOfTimes As Object
        numberOfTimes = 12
        If TypeOf numberOfTimes Is Integer Then
            Dim repeatCount As Integer
            repeatCount = _
                DirectCast(numberOfTimes, Integer)
            For idx As Integer = 1 To repeatCount
                Console.WriteLine("Duncanma")
            Next
        End If

    End Sub

End class
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma
Duncanma








7.21.DirectCast
7.21.1.DirectCast
7.21.2.DirectCast from Integer to MsgBoxResult