How can i get a string and return each time a string from array?

后端 未结 1 1015
刺人心
刺人心 2021-01-23 20:47

I have this function :

private string offline(string targetDirectory)
        {
            string directory = \"\"; 
            try
            {
                      


        
1条回答
  •  时光取名叫无心
    2021-01-23 21:31

    Easiest way - use yield:

    IEnumerable offline(string dir)
    {
        ...
        ... instead of directory = dirs[i] do
        yield return dirs[i];
    }
    

    0 讨论(0)
提交回复
热议问题