I have a class called "Cars.cs" and I need to access the method of the class. I'm doing the following: (razor WebMatrix project in c #)
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();
}
but I have the following problem: Compiler Error Message: CS0246: Can not find the type or namespace name 'Cars' (are you missing a using directive or an assembly reference?)
I tried putting @ {using cars;} and it is not.
grateful if you can help me
thank you!