【发布时间】:2010-11-19 22:30:51
【问题描述】:
- 创建一个新的 ASP.NET MVC Web 应用
- 创建 ASP.NET App_Code 文件夹
-
在新的内部 文件夹,创建一个类 扩展方法。例如:
static public class BugMVCExtension { public static int ToInt(this string str) { return Convert.ToInt32(str); } } 选择一个视图并尝试使用这个新的扩展方法
你会得到这个异常:
CS0121: The call is ambiguous between the following methods or properties:
'*MvcApplication1.App_code.BugMVCExtentions.ToInt(string)*' and
'*MvcApplication1.App_code.BugMVCExtentions.ToInt(string)*'
这里有人有更多相关信息吗? 在 ASP.NET MVC(?) Web 应用程序中创建 App_code 是否错误?
【问题讨论】:
标签: c# .net asp.net-mvc .net-3.5