범위 변수가 부울을 반환하는 정적 메서드에서 평가되는 linq 식을 사용하여 List에서 선택하려고합니다. 메서드를 사용하여 범위 변수를 계산할 때 true를 반환하는 범위 변수를 선택하고 싶습니다.Linq 메서드를 람다 식으로 계산
그것이 대리자 형식이 아니기 때문에 '부울'을 입력 람다 식을 변환 할 수 없습니다 :
var result = from rangeVariable in DataSource
where (rangeVariable => Foo.MethodReturnsBoolean(rangeVariable) == true)
select rangeVariable;
나는이 오류가 발생합니다.
아무도 무슨 일이 일어나고 있는지 설명하고이를 어떻게 달성 할 수 있습니까?
매우! 감사합니다 존! – theringostarrs
+1 내 머리가 회전을 멈춘 후에 대답 할게) – Gishu
Datacontext.table에서 rangeVariable에서 var =를 시도했을 때 어디에 me.MethodThatReturnsBoolean (rangeVariable)을 선택했는지 rangeVariable을 선택했습니다. Runtime이 발생했습니다. NotSupportedException : Method 'Boolean MethodThatReturnsBoolean (System.String) '는 SQL에 대한 변환을 지원하지 않습니다. 어떤 부울 함수가 where 절에 포함될 수 있습니까? 어떤 제안? http://stackoverflow.com/questions/8662259/what-does-intellisense-mean-when-it-shows-that-it-expects-a-condition-in-the-w – bernie2436