【发布时间】:2012-03-05 01:00:52
【问题描述】:
我有这个代码:
String[] lineElements;
. . .
try
{
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
lineElements = line.Split(',');
. . .
但后来我想我应该改用列表。但是这段代码:
List<String> listStrLineElements;
. . .
try
{
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
listStrLineElements = line.Split(',');
. . .
...给我,“无法将类型 'string[]' 隐式转换为 'System.Collections.Generic.List'”
【问题讨论】: