通过 Web 表单上传文件并将其内容解析到列表中如何在解析 C.MN、C.LN、C.Val 时允许 null 或空值这三个是这样声明的公共数据类型
Namespace datatypes
Public class Uploads
{
Public long Mn {get; set;}
Public int LN { get;set }
Public int Val {Get;Set}
}
List<Uploads> CDU = new List<Uploads>();
string[] fields;
string data = read.ReadLine();
while ((data = read.ReadLine()) != null)
{
if (data.Length != 0)
{
Uploads C = new Uploads();
fields = data.Split(',');
C.LN = Convert.ToInt32(fields[0]);
C.MN = Convert.ToInt64(fields[1]);
C.Val = Convert.ToInt32(fields[2]);
CDU.Add(C);