如何在 C# 中将类型 'string' 转换为 'string[]'?

how to convert type 'string' to 'string[]' in c#?

我的代码有点问题请你帮忙:

         String[] Boe;

         Boe = new String[1]; <---- i think the error might also be here 
         BS = new Rectangle();
         for (int p = 0; p < 1; p++)
         {
           //some code have been taken out 

             Boe = "Yes"; <----- this is where the error is being displayed 
         }

您的代码存在问题,您试图将整个数组设置为一个简单的字符串。您必须访问数组的索引,然后为该位置提供一个字符串值。 往下看

 String[] Boe;
 Boe = new String[1]; <---- i think the error might also be here 
 BS = new Rectangle();
 for (int p = 0; p < 1; p++)
 {
   //some code have been taken out 

     Boe[p] = "Yes"; <----- this is where the error is being displayed 
 }

希望对您有所帮助!