vb 使用Array.ConvertAll将object类型数组转为string类型数组

 

vb 使用Array.ConvertAll将object类型数组转为string类型数组有两种方法

1.    方法1   

1 Dim int_array() As Object = {1, 2, 3}

2 Dim str_array() As String = Array.ConvertAll(int_array, Function(n) n.ToString)

 

2.   方法2

1 Dim array1 As Object() = {1, 2}

2         Dim returnValue As String() = Array.ConvertAll(array1, New Converter(Of Object, String)(AddressOf IntToString))

3  

4 Public Shared Function IntToString(ByVal i As Object) As String

5         Return i.ToString()

6     End Function

 

你可能感兴趣的:(String类)