2013-12-17 91 views
2

我有串600線,全部被編號例如:只顯示2用戶輸入號碼之間的字串值

contents[0] = "HALTUNG;" + textBox2.Text + "-01" + " " + textBox2.Text + "-02;" + textBox2.Text + "-01;" + textBox2.Text + "-02"; 
contents[1] = "HALTUNG;" + textBox2.Text + "-02" + " " + textBox2.Text + "-03;" + textBox2.Text + "-02;" + textBox2.Text + "-03"; 
contents[2] = "HALTUNG;" + textBox2.Text + "-03" + " " + textBox2.Text + "-04;" + textBox2.Text + "-03;" + textBox2.Text + "-04"; 
contents[3] = "HALTUNG;" + textBox2.Text + "-04" + " " + textBox2.Text + "-05;" + textBox2.Text + "-04;" + textBox2.Text + "-05"; 
contents[4] = "HALTUNG;" + textBox2.Text + "-05" + " " + textBox2.Text + "-06;" + textBox2.Text + "-05;" + textBox2.Text + "-06"; 
contents[5] = "HALTUNG;" + textBox2.Text + "-06" + " " + textBox2.Text + "-07;" + textBox2.Text + "-06;" + textBox2.Text + "-07"; 

我想寫入文件2用戶輸入號碼前的字符串:(2- 8)或(1-250) 我該怎麼辦?

感謝

+1

我還沒有絲毫的線索想要什麼...你想寫一些用戶輸入值之間的arrayElements? – Vogel612

+5

請告訴我你沒有輸入600個字符串作業? – DGibbs

+0

通過代碼行獲得付款? –

回答

1

您可以使用LINQ SkipTake方法,我assum開始已經開始行號和結束已結束的行號。

var lines = contents.Skip(Start).Take(End-Start); 
+0

這就是我正在尋找的靈感,謝謝! – user3110431

相關問題