How can i get a string and return each time a string from array?
<p>I have this function :</p>

<pre><code>private string offline(string targetDirectory)
        {
            string directory = ""; 
            try
            {
                string[] dirs = Directory.GetDirectories(targetDirectory,"*.*",SearchOption.TopDirectoryOnly);
                for (int i = 0; i &lt; dirs.Length; i++)
                {
                    directory = dirs[i];
                }
            }
            catch
            {

            }
            return directory;

        }
</code></pre>

<p>For example if targetDirectory is c:\ then i get in the array 14 directories. 
Now i want that each time i call the function offline it will return me once the first string c:\$Recycle.Bin 
Then it will return c:\test
and each time i call the function it will return the next string from the array. 
Since im using a recrusive function and calling this offline function from a recrusive i want it to return each time the next string from the array.</p>

<p>Now as it is now it will return the last directory in the array only and thats it.</p>

<p>How can i do it ?</p>
