Den*_*gan 2 c# extension-methods
我似乎无法在同一名称空间(MyProject.Util)中的另一个类中找到以下扩展方法.
using System.Collections.Specialized;
namespace MyProject.Util
{
public static class Extensions
{
public static string Get(
this NameValueCollection me,
string key,
string def
)
{
return me[key] ?? def;
}
}
}
Run Code Online (Sandbox Code Playgroud)
你可以看到它基本上是另一个版本foo[bar] ?? baz,但我仍然不明白为什么VS2008无法编译告诉我没有版本Get需要两个参数.
有任何想法吗?
| 归档时间: |
|
| 查看次数: |
1386 次 |
| 最近记录: |