Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 c# 很陌生。我正在使用单声道。我想遍历 TextView 对象中的每一行并对每一行进行自己的处理。我已将其范围缩小到包含 Text 属性的 Buffer 属性,但此属性包含整个文本。如何将其分解为单独的行/字符串?
string Line; for (int i = 0;i < txtvMain.Buffer.LineCount; i++) { Line = txtvMain.Buffer.?; }
(未经测试)简单的解决方案(也许不是最有效的):
string[] lines = txtvMain.Buffer.Text.split('\n');