The fact that Substring() throws if any little parameter is off makes
it almost unusable.  Don't you think?

For example:

  string s = "test";
  string x = s.Substring(0, 999);  // should return "test", not throw
  string x = s.Substring(0, -1 );  // should return Empty , not throw
  string z = s.Substring(999, 4);  // should return Empty , not throw

I think it shouldn't throw for the same reason the division by zero
doesn't.  It is just too much trouble to always test every division.

The fact that is does throw make the method much less useful.  You
can't just do simple calculations and get the substring because it
might through.

Or is just me?

Cheers...David

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to