Ich habe alle Fragen auf Stack Overflow und im Internet ausprobiert wie die Verwendung von .Normalize() und die Verwendung von @username, aber ich bekomme immer wieder diese Fehlermeldung.
Das ist mein Code:
Code: Select all
foreach (string fileNameInFTP in directories)
{
// string fileNameInFTP2 = Path.GetFileNameWithoutExtension(fileNameInFTP);
if ((!haveWeAlreadyParsedThisFile(fileNameInFTP)) && (fileNameInFTP.Contains("CustsExport")) && (!fileNameInFTP.EndsWith("Empty.xml")) && (!fileNameInFTP.Contains("DelCustsExport")))
{
string file = FTPAddress + "/" + fileNameInFTP;
Console.WriteLine(file);
List customersList =
(
from e in XDocument.Load(file).Root.Elements("cust")
select new Customer
{
MemeberID = (int)e.Attribute("memberid"),
CustomerID = (int)e.Attribute("custid"),
FirstName = (string)e.Attribute("fname"),
LastName = (string)e.Attribute("lname"),
ShowsNumber = (int)e.Attribute("count_noshow"),
VisitNumber = (int)e.Attribute("count_resos"),
Cancellation = (int)e.Attribute("count_cancel"),
MobileNumber = (string)e.Element("phone").Attribute("phonenumber")
/*Projects =
(
from p in e.Elements("projects").Elements("project")
select new Project
{
ProjectCode = (string)p.Element("code"),
ProjectBudget = (int)p.Element("budget")
}).ToArray()*/
}).ToList();
Code: Select all
List customersList =
(
from e in XDocument.Load(file).Root.Elements("cust")
select new Customer
{
MemeberID = (int)e.Attribute("memberid"),
CustomerID = (int)e.Attribute("custid"),
FirstName = (string)e.Attribute("fname"),
LastName = (string)e.Attribute("lname"),
ShowsNumber = (int)e.Attribute("count_noshow"),
VisitNumber = (int)e.Attribute("count_resos"),
Cancellation = (int)e.Attribute("count_cancel"),
MobileNumber = (string)e.Element("phone").Attribute("phonenumber")
/*Projects =
(
from p in e.Elements("projects").Elements("project")
select new Project
{
ProjectCode = (string)p.Element("code"),
ProjectBudget = (int)p.Element("budget")
}).ToArray()*/
}).ToList();