What are the parameters of the substring method in C#?

In C#, the Substring method has two different parameter forms.

  1. One parameter is used: Substring(int startIndex)
  1. The startIndex parameter specifies from which index position to start extracting the substring. It returns the substring starting from the startIndex position until the end of the original string.
  1. Apply two parameters: Substring(int startIndex, int length)
  1. The startIndex parameter specifies from which index position to start extracting the substring.
  2. The length parameter specifies the length of the substring to be taken. It returns a substring of length starting from the position of startIndex.

Note: In C#, index positions are counted starting from 0.

bannerAds