Imports System
Imports System.Reflection
Public Class MainClass
Shared Sub Main( )
Dim theMathType As Type = Type.GetType("System.Math")
Dim paramTypes(0) As Type
paramTypes(0) = Type.GetType("System.Double")
Dim ConsineInfo As MethodInfo = _
theMathType.GetMethod("Sin", paramTypes)
Dim parameters(0) As Object
parameters(0) = 45 * (Math.PI / 180)
Dim returnVal As Object
returnVal = ConsineInfo.Invoke(theMathType, parameters)
Console.WriteLine("The sine of a 45 degree angle is {0}", _
returnVal)
End Sub
End Class
|