Vista, 7, 8 にデフォルトで対応できるようにするには、今のところ .NET Framework は 3.0 がいいかなと思っています(XPでも3.0のインストールは可)。
http://www.atmarkit.co.jp/ait/articles/1210/26/news086.html
しかし、3.0 では ReadOnlyCollection
に toList()
メソッドが無いのです。
調べてみると、簡単に ReadOnlyCollection
を List にできます。
Dim currentDir As String = My.Computer.FileSystem.CurrentDirectory
Dim filesReadOnly = My.Computer.FileSystem.GetFiles(currentDir)
Dim fileList = New List(Of String)(filesReadOnly)
ちなみに配列も同様にできます。
Dim args() As String = System.Environment.GetCommandLineArgs()
Dim argList = New List(Of String)(args)
参考:
http://mrandypuppy.wordpress.com/2006/09/01/converting-from-readonlycollection-to-list/