-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Type of issue
Exception documentation is not accurate.
Description
In the String.Remove method which takes only a startIndex parameter, you may pass a startIndex equal to the length of the string and the string returned is the same as the string passed in. This contradicts the remarks in the documentation:
The value of the startIndex parameter can range from zero to one less than the length of the string instance."
The documentation states that an ArgumentOutOfRangeException is thrown if "startIndex specifies a position that is not within this string." However, this does not happen.
This method calls Substring which states an ArgumentOutOfRangeException is thrown if "startIndex is less than zero or greater than the length of this instance." That wording would make sense to reuse for the exception documentation in this method.
Note: accidentally closed the original issue here: #11300.
Page URL
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System/String.xml
Document Version Independent Id
bf50904f-f0ff-1d7f-b23e-6ad2e08930ce
Platform Id
c27a4a36-d9f6-1645-1e78-92b328516d7b