为什么没有在VS 2008年智能感知显示扩展方法String类 [英] Why doesn't VS 2008 display extension methods in Intellisense for String class

查看:123
本文介绍了为什么没有在VS 2008年智能感知显示扩展方法String类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于字符串农具的IEnumerable<焦炭> ,我期待看到在智能感知可枚举扩展方法,例如,在

Since String implements IEnumerable<char>, I was expecting to see the Enumerable extension methods in Intellisense, for example, when typing the period in

String s = "asdf";
s.

我期待看到。选择&LT;烧焦&GT;(...) .ToList&LT;烧焦&GT;()等。
当时我很惊讶地看到,扩展方法的在String类的工作其实,他们只是不显示在IntelliSense中了。有谁知道这是为什么?
这可能与<一href=\"http://stackoverflow.com/questions/295287/how-can-i-$p$pvent-a-public-class-that-provides-extension-methods-from-appearing\">this问题。

I was expecting to see .Select<char>(...), .ToList<char>(), etc. I was then suprised to see that the extension methods do in fact work on the string class, they just don't show up in Intellisense. Does anyone know why this is? This may be related to this question.

推荐答案

这是由明确的设计。现在的问题是,虽然字符串最肯定农具的IEnumerable&LT; T&GT; ,大多数人都没有想到的,或者更重要的是用它,在这种方式。

It's by explicit design. The problem is that while String most definitely implements IEnumerable<T>, most people don't think of it, or more importantly use it, in that way.

字符串有相当数量少的方法。最初我们并没有过滤扩展方法了字符串,结果是很多负面的反馈。它几乎三倍的方法的数量在用正确的进口倍。与所有显示的扩展方法,人们往往看不到他们正在寻找在噪声字符串的方法。

String has a fairly small number of methods. Initially we did not filter extension methods off of String and the result was a lot of negative feedback. It almost tripled the number of methods at times with the right imports. With all of the extension methods displayed, people often couldn't see the String method they were looking for in the noise.

字符串是......简单类型,它是更好的观看这种方式:)

String is a ... simple type and it's better to view it that way :)

这还是完全有可能呼吁字符串的扩展方法。这只是可能不会在IntelliSense露面。

It's still completely possible to call an extension method on string. It's just likely not going to show up in intellisense.

编辑:字符串实际上有相当多的一些方法。但是,由于很多都是重载他们在智能感知崩溃。

String actually has quite a few methods. But because many of them are overloads they collapse in intellisense.

这篇关于为什么没有在VS 2008年智能感知显示扩展方法String类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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