title: C# Index and length must refer to a location within the string
body: <p>i've got this error while i'm using the <b>substring</b> method.</p>
  
  <p>i'm trying to execute this very simple code:</p>
  
  <pre><code>string bla = selected.Substring((selected.IndexOf('(')+1), (selected.Length-1))
  </code></pre>
  
  <p>selected value could be <b>blabla(bla)</b> and i want to get just the 'bla' inside the brackets...</p>
  
  <p>edit: i want to know if there is a way to do everything on one line, thank for all the answers
  edit2: the right answer is </p>
  
  <pre><code>selected.Substring((selected.IndexOf('(') + 1), (selected.Length - selected.IndexOf('(') - 2))
  </code></pre>
  
  <p>thank to sinatr, i did a stupid mistake</p>