Saturday, July 16, 2011

Is it possible to use the extension method in Expression shape of BizTalk 2010

Charan: I have created one extension method  to count the no of words (separated by character space ,  dot or question mark)  in a string by following this link.

Now I want to know is it possible to use the extension method in Expression shape of BizTalk 2010http://i3.social.s-msft.com/Forums/resources/images/trans.gif?cver=1864.870%0d%0a.

This is the extension method I have created.

 And this is test code to execute test it.


Rohit: The answer is no and yes

In your test code you have declared the namespace (DemoExtensionMethodForString) for the static class (MyExtensions) created for the extension method (WordCount) by specifying it with the using statement and you can't use the using statement in the expression shape so you can't use it in the same way as you have used in your test code i.e. as instance method of string variable.

But your extension method is just a static method created in a static class so can be executed it in expression shape as shown below:

Any comments or suggestions are welcome.

Cheers
Rohit Sharma


No comments:

Post a Comment