Problem with Substring() - ArgumentOutOfRangeException

后端 未结 11 1726
抹茶落季
抹茶落季 2020-12-20 11:29

I have a repeater that displays data from my Projects table. There are projectId, name and description. I use Substring(1, 240) on description. But sometimes the string is s

11条回答
  •  天命终不由人
    2020-12-20 12:14

    You can use LINQ as below:

    string someString = "abcde"; 
    string subStr = string.Join("", someString.Take(240));
    

提交回复
热议问题