Array.ToString() returning System.Char[] c#

前端 未结 4 1161
孤城傲影
孤城傲影 2020-12-11 21:09

Im making a hangman game, at the start of the game the word that the player must guess is printed as stars. I have just started making it again after attempting to write it

4条回答
  •  误落风尘
    2020-12-11 22:00

    The correct way to do this would be:

    string StarString = new string(stars);
    

    ToString() calls the standard implementation of the Array-class's ToString-method which is the same for all Arrays and similarily to object only returns the fully qualified class name.

提交回复
热议问题