我正在通過一個關於YouTube的ASP.NET MVC 5教程。我真的很喜歡它。但是,我被困在似乎是一個奇怪的錯誤。奇怪的意思我認爲我有教程中輸入的所有內容,但VS2013正在標記我,我無法弄清楚什麼可能是錯的。將數學變量定義爲課程似乎很好。但是,它不喜歡數學。ASP.NET MVC 5教程錯誤:無法找到類型或名稱空間名稱
型號/ Course.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyfirstProject.Models
{
public class Course
{
int CourseID { get; set; }
string CourseName { get; set; }
int TotalCredits { get; set; }
}
}
控制器/ XyzController.cs
using MyfirstProject.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MyfirstProject.Controllers
{
public class XyzController : Controller
{
// GET: Xyz
public ActionResult Abc()
{
Course math = new Course();
.....
.....
似乎沒有什麼是你的代碼錯誤只是嘗試清洗液並重建公衆。 –
注意:您已在課程POCO模型中將所有屬性創建爲私有。我認爲這本來是要公開的。 –
我試過清潔和重建。然後關閉並重新打開。什麼是私人?我不熟悉術語POCO。也許這就是爲什麼我不明白。 – abalter