System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string

前端 未结 5 1999
野趣味
野趣味 2020-12-18 03:25

I have this code. I am trying to retrieve just the text \"first program\". Considering that i know the index say 25 and total length of string is 35.

string          


        
5条回答
  •  离开以前
    2020-12-18 04:06

    During this time you can use

    (LINQ ElementAt) and (ElementAtOrDefault) method. However the ElementAt extension method would throw the System.ArguementOutOfRangeException when the specified index is a negative value or not less than the size of the sequence .

提交回复
热议问题