Hello,
I am writing some class and it wont compile without "using System.Linq". But i don't understand why its needed. What i am writing has nothing to do with Linq. How can i find out where a namespace is used?
And the very badly written piece of code (I am trying to figure out what i want it to do):
using System;
using System.Collections;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
namespace DateFilename
{
public class FailedFieldsList
{
private static List<FailedFields> ErrorList = new List<FailedFields>();
public void AddErrorList(FailedFields errs)
{
ErrorList.Add(errs);
}
public void addSingleFailedField(string vField, string vMessage)
{
//FailedFields
}
public List<FailedFields> GetErrorList()
{
return ErrorList;
}
public class FailedFields
{
public List<FailedField> ListOfFailedFieldsInOneRecord = new List<FailedField>();
public class FailedField
{
public string fieldName;
public string message;
public FailedField(string vField, string vMessage)
{
this.fieldName = vField;
this.message = vMessage;
}
public override string ToString()
{
return fieldName + ", " + message;
}
}
public void addFailedField(FailedField f)
{
ListOfFailedFieldsInOneRecord.Add(f);
}
public int getFailedFieldsCount()
{
return ListOfFailedFieldsInOneRecord.Count();
}
}
}
}
Error message produced when i dont include the linq namespace:
Error 4 Non-invocable member 'System.Collections.Generic.List<DateFilename.FailedFieldsList.FailedFields.FailedField>.Count' cannot be used like a method. D:\Slabo\My Documents\Visual Studio 2008\Projects\DateFilename\DateFilename\FailedFieldsList.cs 47 54 DateFilename
Thanks