Monday, March 26, 2012

StringCollection

Hi

I got this function in C#:


internal string JoinStringCollection(StringCollection SC)
{
string[] ToListArray = new string[SC.Count];
SC.CopyTo(ToListArray,0);
return string.Join("; ",ToListArray);
}

I converted it as follows, but cant seem to get the right syntax:


Friend Function JoinStringCollection(ByVal SC As StringCollection) As String

Dim ToListArray() As String = New String(SC.Count) 'This generates error, expects char?
SC.CopyTo(ToListArray, 0)
Return String.Join("; ", ToListArray)
End Function

Add "{}" at the end of the "New" statement

AutoFed
Try this:
Dim ToListArray(SC.Count) As String

0 comments:

Post a Comment