Autor Beitrag
Stephan202
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Sa 27.08.11 17:56 
Hallo,

ich habe eine T list namens table1:

List<string[]> table1 = new List<string[]>();

Diese muss ich in ein Array des Typs string[,] umwandeln.
Mit table1.ToArray() bekomme ich leider nur ein Array< des Typs string[][].

Wie kann man die gewünschte Konvertierung mögl. effizient lösen?

Besten Dank im Vorraus!
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Sa 27.08.11 18:04 
Da mehrdimensionale Arrays auf der CLR eher die zweite Geige spielen (und solche string[][]-Arrays zumindest in Sachen Geschwindigkeit sogar bevorzugt werden sollten) wirst du denke ich nicht darum herumkommen, das Array eigenhändig per Indexschlacht zu füllen.

_________________
>λ=
Stephan202 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Sa 27.08.11 18:10 
Ja,
Geschwindigkeit ist auch ein Problem-Thema.
Was von beiden ist eigentlich schneller: Tlist oder string[][]-Array?
Notfalls muss ich halt mit der Tlist weiterrechnen
und alle anderen Codes umschreiben.
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Sa 27.08.11 18:18 
Ich denke, für solche Mikrooptimierungen wirst du einen Profiler fragen müssen. Natürlich führt beispielsweise der Indexzugriff einer List<> als Array-Wrapper einen minimalen Overhead mit sich, aber das Umkopieren ist eben auch nicht kostenlos.

PS: TList? Die findet man eher eine Ecke weiter im Delphi-Forum :D .

_________________
>λ=