【发布时间】:2013-05-04 22:51:49
【问题描述】:
我有一个名为“Cars.cs”的类,我需要访问该类的方法。我正在执行以下操作: (c# 中的razor WebMatrix 项目)
using System;
using System.Collections.Generic;
using System.Web;
public class Cars
{
public string cars {get;set;}
public int number {get;set;}
public Cars()
{
}
public List<Car> GetCars()
{
List<Car> list = new List<Car>
{
new Car{cars="Ford",number=432},
new Car{cars="Fiat",number=798}
};
return list;
}
}
默认.cshtml
@{
Cars c = new Cars();
c.GetCars();
}
但我有以下问题: 编译器错误消息:CS0246:找不到类型或命名空间名称“Cars”(您是否缺少 using 指令或程序集引用?)
我试过把 @ {using cars;} 放上去,但不是。
如果你能帮助我,感激不尽
谢谢!
【问题讨论】:
标签: razor webmatrix-2