【发布时间】:2009-11-11 11:26:51
【问题描述】:
CS0234:名称空间“MyWebsite.Commerce”中不存在类型或名称空间名称“ShoppingCart”(您是否缺少程序集引用?)
public class ProfileCommon : System.Web.Profile.ProfileBase {
public virtual MyWebsite.Commerce.ShoppingCart Cart {
get {
return ((MyWebsite.Commerce.ShoppingCart)(this.GetPropertyValue("Cart")));
}
set {
this.SetPropertyValue("Cart", value);
}
}
public virtual string Country {
get {
return ((string)(this.GetPropertyValue("Country")));
}
set {
this.SetPropertyValue("Country", value);
}
}
public virtual string Gender {
get {
return ((string)(this.GetPropertyValue("Gender")));
}
set {
this.SetPropertyValue("Gender", value);
}
}
public virtual int Age {
get {
return ((int)(this.GetPropertyValue("Age")));
}
set {
this.SetPropertyValue("Age", value);
}
}
public virtual ProfileCommon GetProfile(string username) {
return ((ProfileCommon)(ProfileBase.Create(username)));
}
}
当我运行此页面时发生错误,当我单击错误行时,它会转到上面的代码,请任何人尽快帮助我......
【问题讨论】:
-
您的购物车类在哪里?我怀疑它不是您认为的位置,或者您没有添加对它的引用。
-
我认为错误信息很清楚:
ShoppingCart does not exist in the namespace MyWebsite.Commerce。ShoppingCart类在哪里声明?如果它不在同一个程序集中,您是否引用了此程序集? -
阅读错误信息!!
标签: asp.net