2
我有一个名为“Cars.cs”的类,我需要访问该类的方法。我做了以下内容: (在C#剃刀WebMatrix的项目)如何在WebMatrix(oop)中调用类方法?
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;
}
}
Default.cshtml
@{
Cars c = new Cars();
c.GetCars();
}
,但我有以下问题: 编译器错误消息:CS0246:能找不到类型或命名空间名称'Cars'(你是否缺少使用指令或程序集引用?)
我试着把@ {使用汽车;}它不是。
感谢您,如果你能帮助我
谢谢!
谢谢,这有帮助! – MauricioHz 2013-05-06 01:11:03