title: Replace single chars in string at position x
body: <p>I am doing a simple hangman game. I have gotten everything going except for the part where the user enters a correct char and the corresponding char in the solution word should be replaced with the former.</p>
  
  <p>First, here is my code:</p>
  
  <pre><code>private void checkIfLetterIsInWord(char letter)
  {
      if (currentWord != string.Empty)
      {
          if (this.currentWord.Contains(letter))
          {
              List&lt;int&gt; indices = new List&lt;int&gt;();
              for (int x = 0; x &lt; currentWord.Length; x++)
              {
                  if (currentWord[x] == letter)
                  {
                      indices.Add(x);
                  }
              }
              this.enteredRightLetter(letter, indices);
          }
          else
          {
              this.enteredWrongLetter();
          }
      }
  }
  
  
  private void enteredRightLetter(char letter, List&lt;int&gt; indices)
  {
      foreach (int i in indices)
      {
          string temp = lblWord.Text;
          temp[i] = letter;
          lblWord.Text = temp;
  
      }
  }
  </code></pre>
  
  <p>So my problem is the line</p>
  
  <pre><code>temp[i] = letter;
  </code></pre>
  
  <p>I get an error here that says "Property or indexer cannot be assigned to — it is read only". I have already googled and found out that strings cannot be modified during runtime. But I have no idea how to substitute the Label which contains the guesses. The label is in the format</p>
  
  <pre><code>_ _ _ _ _ _ _ //single char + space
  </code></pre>
  
  <p>Can anybody give me a hint how I can replace the chars in the solution word with the guessed chars? </p>