Код: Выделить всё
Operator '==' cannot be applied to operands of type 'char' and 'string'
Код: Выделить всё
void Main()
{
var csvlines = File.ReadAllLines(@"M:\smdr(backup08-06-2015).csv");
var csvLinesData = csvlines.Skip(1).Select(l => l.Split(',').ToArray());
var csvData = csvLinesData.Where(l => (!l[12].Contains("VM") && l[12] != "Voice Mail")).ToArray();
var user = (from r in csvData
orderby r[12]
select new User
{
CSRName = r[12],
Incomming = (from r1 in r
where r1[4] == "I"
select r1).Count(),
outgoing = (from r1 in r
where r1[4] == "O"
select r1).Count()
}).ToList();
user.Dump();
}
class User
{
public string CSRName;
public int Outgoing;
public int Incomming;
public int calltransfer;
}
Согласно предложению я отредактировал код
Код: Выделить всё
select new User
{
CSRName=r[12],
Incomming=(from r1 in r
where r1[4]=='I'
select r1).Count(),
outgoing = (from r1 in r
where r1[4] == 'O'
select r1).Count()
}).ToList();
Код: Выделить всё
IndexOutOfRangeException: Index was outside the bounds of the array.
Где я делаю ошибку?
Подробнее здесь: https://stackoverflow.com/questions/308 ... and-string