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
Post a Comment