Convert From Custom List to List of String

Posted by Paul Johnson on Stack Overflow See other posts from Stack Overflow or by Paul Johnson
Published on 2010-03-25T12:34:49Z Indexed on 2010/03/25 12:53 UTC
Read the original article Hit count: 473

Hi all I have the following code:

    Public Shared Function ConvertToString(ByVal list As IList) As String
        Dim strBuilder = New System.Text.StringBuilder()
        Dim item As Object
        For Each item In list
            strBuilder.Append(obj.ToString())
            strBuilder.Append(",")
        Next
        Return strBuilder.ToString(strBuilder.Length - 1)
    End Function

The intention is to convert an IList of custom objects to a string equivalent comprising each element in the Ilist. Unfortunately I can't seem to find a way to get the underlying data of the custom object, and of course as in the above example, using object simply gives me a string of types definitions, rather than access to the underlying data. Any assistance much appreciated.

Paul.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about convert