什么是在.NET中使用扩展方法的最佳实践? [英] What are the best practices for using Extension Methods in .Net?

查看:99
本文介绍了什么是在.NET中使用扩展方法的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到这些正在使用的各种方法,并已被指控利用他们的错误的方式(尽管在这种情况下,我用他们的方式来表现出的)。

I have seen these being used every which way, and have been accused of using them the wrong way (though in that case, I was using them that way to demonstrate a point).

那么,你认为什么是使用扩展方法的最佳实践?

So, what do you think are the best practices for employing Extension Methods?

如果开发团队创建的扩展方法库,并在各个项目中进行部署?

Should development teams create a library of extension methods and deploy them across various projects?

如果有在一个开源项目的形式?

Should there be a collection of common extension methods in the form of an open source project?

更新:决定创建一个组织广泛的扩展方法库

推荐答案

我会建议你看看下面的博客文章:

I would recommend that you check out the following blog article:

<一个href="http://blogs.msdn.com/vbteam/archive/2007/03/10/extension-methods-best-practices-extension-methods-part-6.aspx" rel="nofollow">http://blogs.msdn.com/vbteam/archive/2007/03/10/extension-methods-best-practices-extension-methods-part-6.aspx

它如何使用扩展方法的指导。

It has some guidelines for how to use extension methods.

我写了回来,当我用微软工作,我在那里上实现的扩展方法VB编译器团队的人。

I wrote it back when I used to work for Microsoft, where I was the guy on the VB compiler team that implemented extension methods.

这篇关于什么是在.NET中使用扩展方法的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆