C# How can I read all jpeg files in a directory using a Filestream so the files aren't locked?
<p>How can I read all jpeg files in a directory using a Filestream so the files aren't locked? My current code is below, there is no mention of Filestream as I can't get it to work. Many thanks for any help.</p>

<pre><code>    public Form1()
    {
        InitializeComponent();

        images = new List&lt;Image&gt;();
        // add images

        DirectoryInfo di = new DirectoryInfo(@"\\server\files\");
        FileInfo[] finfos = di.GetFiles("*.jpg", SearchOption.TopDirectoryOnly);
        foreach (FileInfo fi in finfos)
            images.Add(Image.FromFile(fi.FullName));

   }

    private void buttonNext_Click(object sender, EventArgs e)
    {
        index++;
        if (index &lt; 0 || index &gt;= images.Count)
            index = 0;
        pictureBox1.Image = images[index];
        int count = index + 1;
        labelCount.Text = "Showing " + count.ToString() + " of " + images.Count;
    }
</code></pre>
