none
Error: Cannot implicitly convert type 'string[]' to 'string'

    Question

  • Error Cannot implicitly convert type 'string[]' to 'string'
    for the assignment
        arrDevices = new string[]
     in the code below;

      string device1 = name.Substring(16, 54);
      string device2 = name.Substring(90, 47);
    
      string[] arrOfDevices;
    
      arrOfDevices = new string[] { device1, device2 };

    Thank you for your help.  -greg

     

    Monday, December 14, 2009 4:28 PM

Answers


  • I put that code into a test class and it compiled (after I created the 'name' string).
    • Marked as answer by hazz Monday, December 14, 2009 4:43 PM
    Monday, December 14, 2009 4:33 PM

All replies


  • I put that code into a test class and it compiled (after I created the 'name' string).
    • Marked as answer by hazz Monday, December 14, 2009 4:43 PM
    Monday, December 14, 2009 4:33 PM
  • Thank you for being the 'second set of eyes"  
    I had a statement prior to this line without a semicolon.
    Ouch.
    Thank you again.

    Monday, December 14, 2009 4:44 PM