3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ReadOnlyCollection を List にする

Posted at

Vista, 7, 8 にデフォルトで対応できるようにするには、今のところ .NET Framework は 3.0 がいいかなと思っています(XPでも3.0のインストールは可)。
http://www.atmarkit.co.jp/ait/articles/1210/26/news086.html

しかし、3.0 では ReadOnlyCollectiontoList() メソッドが無いのです。

調べてみると、簡単に 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/

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?