开发者

Silverlight Extension Methods in Class Library

I've implemented some extension methods as defined here. I've put these into a separate assembly - Brandon.Extensions. It builds against the Silverlight runtime. I have a Silverlight application in which I would like to use these extension methods. I have added a reference to the Brandon.Extensions project from my Silverlight project - no problems. However, I can't get the extensions to show up. On the page I want to use an extension method on I start typing Imports Brandon.Extensions at the top of the code page, and no intellisens开发者_如何学运维e appears for that namespace.

I'm not sure if this is a Silverlight issue or an issue with extensions in general. How do I get those extension methods to be usable in the Silverlight app?

Notes:

Inside the Brandon.Extensions project, the root namespace is Brandon.Extensions, and the Module which holds my extensions is named IEnumerableExtensions. The Silverlight project is named Brandon.SilverlightApp and the root namespace is the same.


Figured it out. I just had the module defined with no access modifier, so it defaulted to "Friend." I changed it to "Public" instead, and it worked fine.


You need to create your Extensions project from the "Silverlight Class Library" new project template, and not the "Silverlight Application" template.

Jim

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜