C# 应该是蛮简单的一个问题
//根据用户选择来确定要被发送的文件格式
ArrayList sendType = new ArrayList();
if (Utils.xml.ToString() == "true")
sendType.Add(".xml");
if (Utils.eml.ToString() == "true")
sendType.Add(".eml");
if (Utils.doc.ToString() == "true")
sendType.Add(".doc");
if (Utils.docx.ToString() == "true")
sendType.Add(".docx");
if (Utils.xls.ToString() == "true")
sendType.Add(".xls");
if (Utils.xlsx.ToString() == "true")
sendType.Add(".xlsx");
if (Utils.txt.ToString() == "true")
sendType.Add(".txt");
if (Utils.pdf.ToString() == "true")
sendType.Add(".pdf");
if (Utils.rar.ToString() == "true")
sendType.Add(".rar");
if (Utils.zip.ToString() == "true")
sendType.Add(".zip");
foreach (string f in files)
{
//先检查文件名
string path = f;
string newpath = path;
string fullname = Path.GetFileName(path);//返回文件名和后缀名
string name = Path.GetFileNameWithoutExtension(path);//返回文件名
string extn = Path.GetExtension(path);//返回后缀名
if (!sendType.Contains(extn))
break; byte[] Bytes = System.Text.Encoding.Default.GetBytes(fullname);//获得文件名+后缀名的字节数组
byte[] nameBytes = System.Text.Encoding.Default.GetBytes(name);//获得文件名的字节数组
byte[] extnBytes = System.Text.Encoding.Default.GetBytes(extn);//获得后缀名的字节数组
string newname = fullname;//新(文件名+后缀名)
……
我用break调试的结果是,如果文件格式不对应的话就又从文件夹的第一个文件开始遍历,而我想不对应的时候就不往下进行其他操作,再从下一个文件检查,该用什么语句?
...全文


