한 줄의 코드를 작성한 지 오래되었으므로 잠시만 기다려주세요.C# : 'IEnumerable <Student>'에 'Interters'에 대한 정의가 없습니다.
IntelliSense에서 Names 뒤에 Intersect 메서드가 표시 되더라도 두 개의 IEnumerable을 비교할 때 다음 오류가 발생합니다.
데이터베이스 쿼리 결과와 html의 정렬 된 목록을 비교하려고합니다. '교차'에 대한 정의 및 최고의 확장 메서드 오버로드 'Queryable.Intersect (된 IQueryable, 는 IEnumerable을)'가 포함되어 있지 않습니다
의 수신기가 필요'는 IEnumerable'유형 '된 IQueryable'
namespace Data.Repositories
{
public class StudentsRepository
{
public class Student
{
public string FullName { get; set; }
}
public static IEnumerable<Student> GetData(string CardNumber, string Section)
{
// FullName varchar(300) in Database
return CommonFunctions.ExecuteReader1<Student>(QryStudentSectionDetails(CardNumber, Section)).AsQueryable();
}
}
}
namespace Tests.ActionsLibrary.StudentPaper
{
public class StudentActions:TestBase
{
bool IsMatch = false;
// Get Names from DataBase
IEnumerable<Student> Names = GetData(CardNumber, Section);
// Get Names from Ordered list in HTML
IEnumerable<IWebElement> OrderedList = driver.FindElements(By.XPath("//li[@ng-repeat='Names']"));
if (Names.Count() == OrderedList.Count() && Names.Intersect(OrderedList).Count() == OrderedList.Count()) // The error is shown here.
{ IsMatch = true; }
내가 뭘 잘못하고 있는지 궁금해. 어떤 도움이라도 대단히 감사하겠습니다. 감사.
는 끝에서 코드는 다음과 같습니다
IEnumerable<string> Names = GetData(CardNumber, Section).Select(s => s.FullName);
IEnumerable<string> OrderedList = driver.FindElements(By.XPath("//li[@ng-repeat='Names']")).Select(i => i.Text);
당신의 도움을 대단히 감사합니다.
'Students'와'IWebElements'가 어떻게 교차 할 것이라고 생각합니까? 그 위에 다른 문제가있을 수도 있지만, 실제로는 처리해야 할 문제입니다. – SimpleVar