Need a expression to pass as parameter in c# -


i using external dll reference.

when try consume method asking expression parameter filter results.

its expecting type follows

expression<func<template, bool>> type parameter.

the template type has name , group id properties.

i trying create expression check if object equal group id , if name contains in list of items follows.

expression<func<template, bool>> filtertemplatesdestination = tmplt =>     stselectedtemplates.contains(tmplt.name) &&     tmplt.templategroupid == stdestgroupid; 

but when assign expression method getting exception. if use group id filter work fine. expression throwing exception when use condition check if name exists in condition.

i guess nullreferenceexception, don't see other possible exception in code. try this:

expression<func<template, bool>> filtertemplatesdestination = tmplt =>             (stselectedtemplates!= null && tmplt.name!=null &&  stselectedtemplates.contains(tmplt.name)) &&             tmplt.templategroupid == stdestgroupid; 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -