vb Array.ConvertAll 泛型方法

 1 Imports System

 2 Imports System.Drawing

 3 Imports System.Collections.Generic

 4 

 5 Public Class Example

 6 

 7     Public Shared Sub Main()

 8 

 9         Dim apf() As PointF = { _

10             New PointF(27.8, 32.62), _

11             New PointF(99.3, 147.273), _

12             New PointF(7.5, 1412.2)  }

13 

14         Console.WriteLine()

15         For Each p As PointF In apf

16             Console.WriteLine(p)

17         Next

18 

19         Dim ap() As Point = Array.ConvertAll(apf, _

20             New Converter(Of PointF, Point)(AddressOf PointFToPoint))

21 

22         Console.WriteLine()

23         For Each p As Point In ap

24             Console.WriteLine(p)

25         Next

26 

27     End Sub

28 

29     Public Shared Function PointFToPoint(ByVal pf As PointF) _

30         As Point

31 

32         Return New Point(CInt(pf.X), CInt(pf.Y))

33     End Function

34 End Class

 

你可能感兴趣的:(convert)