title: How to find an Index of a string in a list
body: <p>So what I am trying do is retrieve the index of the first item, in the list, that begins with "whatever", I am not sure how to do this.</p>
  
  <p>My attempt (lol):</p>
  
  <pre><code>List&lt;string&gt; txtLines = new List&lt;string&gt;();
  //Fill a List&lt;string&gt; with the lines from the txt file.
  foreach(string str in File.ReadAllLines(fileName)) {
    txtLines.Add(str);
  }
  //Insert the line you want to add last under the tag 'item1'.
  int index = 1;
  index = txtLines.IndexOf(npcID);
  </code></pre>
  
  <p>Yea I know it isn't really anything, and it is wrong because it seems to be looking for an item that is equal to npcID rather than the line that begins with it.</p>