请问文本文件txt的内容如何读取到数据集合比如arraylist中

哥本哈士奇 2006-04-28 11:50:55
txt的文件内容格式大概如下

01 本人
02 户主
03 小集体户主
10 配偶
11 夫
12 妻

谢谢
...全文
191 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Knight94 2006-04-28
  • 打赏
  • 举报
回复
Sample code as follows:

string strData = txtMultiLines.Text;
strData = strData.Replace( "\r\n", "\r" );
string[] strItems = strData.Split( '\r' );
for( int i = 0; i < strItems.Length; ++i )
Debug.WriteLine( strItems[i] );

// You can add them into arraylist
/*
ArrayList arrData = new ArrayList();
arrData.AddRange( strItems );*/

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧