找不到自定义类~~是怎么回事
using System;using System.Collections.Generic;
using System.Text;
using webModel;
namespace webDaL
{
public class UserDao
{
public int InsertUser();
User u = new User();//找不到User类是为什么啊~~~~
}
} --------------------编程问答--------------------
你自定义过 类 User 吗? --------------------编程问答-------------------- 定义过 在webModel文件夹里 --------------------编程问答-------------------- 类都要必须放在APPcode文件夹里吗? --------------------编程问答-------------------- 引用命名空间 --------------------编程问答-------------------- 看看USER是不是PUBLIC的。 --------------------编程问答-------------------- 那你要找到啊 XXXX.User u=new XXXX.User(); --------------------编程问答-------------------- webModel 里面定义的类 是public的类型的吗 --------------------编程问答-------------------- 那是自定义的,你根本没有引用它的命名空间或者根本没有这个类 --------------------编程问答-------------------- User类是这样的
using System;
using System.Collections.Generic;
using System.Text;
namespace webModel
{
[Serializable()]
public class User
{
private int userId;
public int UserId
{
get { return userId; }
set { userId = value; }
} --------------------编程问答-------------------- webModel.User u = new webModel.User();// --------------------编程问答-------------------- 1.你定义过了user
2。如果是其他的程序集中的,你引用那个dll了吗?引用项目了吗?
3. 你的类的可见度够吗? --------------------编程问答--------------------
webModel文件夹?
那你就应该继续点
using webModel.类名命空间。
在不出来,拿棍子敲出来 --------------------编程问答-------------------- 没办法右键点User 转到定义 报无法导航到User 啥情况~~~~ using webModel.User 还是不出来 难道要重装VS --------------------编程问答-------------------- 把类放到App_Code 文件夹中就好了~~~~这是啥情况啊
--------------------编程问答-------------------- 先添加引用
+1 --------------------编程问答-------------------- 你这个定义的类在同一个项目下么?没有的话请引用过来。
补充:.NET技术 , ASP.NET