Hallo Liste,

Weiss jemand wie ich aus einer ArrayList einen comma-separated String bauen
kann? Habe folgendes VB-Beispiel gefunden
(http://www.dotnetbips.com/displayarticle.aspx?id=93):

        Dim arrLst As New ArrayList()
        Dim strFinal As String
        Dim strarr() As String

        arrLst.Add("[EMAIL PROTECTED]")
        arrLst.Add("[EMAIL PROTECTED]")
        arrLst.Add("[EMAIL PROTECTED]")

        strarr = arrLst.ToArray(Type.GetType("System.String"))
        strFinal = String.Join(",", strarr)

Ich brauche das ganze aber in C#. Und C# ist etwas kleinlicher was das
Casten von Variablen angeht. Das hier:

        ArrayList arrLst;
        string[] strarr;
        strarr = new string[3];

        arrLst.Add("[EMAIL PROTECTED]");
        arrLst.Add("[EMAIL PROTECTED]");
        arrLst.Add("[EMAIL PROTECTED]");

        strarr = arrLst.ToArray(Type.GetType("System.String"));

funzt nicht: Cannot implicitly convert type 'System.Array' to 'string[]'

Also wie bekomme ich einen Array bestehend aus Strings aus dem ArrayList
heraus?

Th.


| [aspdedotnet] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp

Antwort per Email an