title: Why does the Xamarin equivalent of EditText.getText() return a string?
body: <p>I'm a new Xamarin.Android developer. I was reading through some Java code recently that used <code>EditText</code> methods in a derived class. One of the derived class' methods looked like this:</p>
  
  <pre><code>private void checkMatchingBracket(int paramInt)
  {
      getText().removeSpan(this.openBracketSpan);
      getText().removeSpan(this.closeBracketSpan);
      ...
  }
  </code></pre>
  
  <p>This confused me because I thought <code>getText()</code> returned a <code>String</code>, as the <code>EditText.Text</code> property is a <code>string</code> in this class' Xamarin counterpart. However, this is not the case; it appears that <code>getText()</code> returns an <a href="https://developer.android.com/reference/android/text/Editable.html" rel="nofollow noreferrer"><code>Editable</code></a>, which looks like a mutable string type that offers additional functionality such as attaching 'spans' to certain regions of text (<a href="https://developer.android.com/reference/android/text/SpannableString.html" rel="nofollow noreferrer"><code>SpannableString</code></a>?). My guess is that the <code>string</code> Xamarin returns has been copied over from the text of this <code>Editable</code>, so I can't really modify the original <code>Editable</code> and use its APIs.</p>
  
  <p>Am I correct? Is it not possible to get access to the original <code>Editable</code> here because I'm using Xamarin?</p>
  
  <p><strong>edit:</strong> The specific thing I'm looking to do is color regions of the text in an <code>EditText</code>. I found <a href="https://stackoverflow.com/a/10242512/4077294">this answer</a> which uses spans to achieve this:</p>
  
  <pre><code>TextView textView = (TextView)findViewById(R.id.mytextview01);
  Spannable WordtoSpan = new SpannableString("partial colored text");        
  WordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 2, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  textView.setText(WordtoSpan);
  </code></pre>
  
  <p>However, Xamarin's API <code>EditText.Text.set</code> only accepts a .NET <code>string</code>, which obviously has no notion of color or 'spans'.</p>