How do you use an extension method in an InvokeMethod workflow? -
i have system.activities.statements.invokemethod
activity. i'm trying activate with
targettype: (null) targetobject: licxfiles //an icollection<string> methodname: storeifhasvalue
the storeifhasvalue
:
public static void storeifhasvalue(this icollection<string> collection, string value) { if (value.isnullorempty( )==false) collection.add(value); }
the param i'm passing workflow designer :
direction: in type: string value: licxutilities.checkforlicx(projectpath,doc)
checkforlicx
:
public static string checkforlicx(string projpath, xdocument proj) { var ns=proj.root.name.namespace; var q = refs in proj.root.elements(ns+"itemgroup").descendants(ns+"embeddedresource") refs.attribute("include").value.endswith(".licx", stringcomparison.currentcultureignorecase) select refs.attribute("include").value; var licx=q.firstordefault( ); //assume there 1 .licx file reference in project if (licx.isnullorempty( )) return null; return system.io.path.combine(projpath, licx); }
is problem i'm using method call param? or why give error
'icollection`1' not have public instance method named 'storeifhasvalue' matching parameter types, generic type arguments, , generic type constraints supplied invokemethod 'check , store'.
never tried suspect need treat static method call, is, , pass object first parameter. empty targetobject property , set targettype class implements extension method.
Comments
Post a Comment