How do namespace work in C#?

  • Thread starter Thread starter Arvind16
  • Start date Start date
A

Arvind16

Guest
Hi,

I'm new to C# and .NET Core Framework. I'm trying to change the file structure of my project. I created a 'Models' Folder and followed convention similar to the 'Controllers' folder that already exists setting the namespace to 'project.FolderName' but when I add this namespace and move the file my controller file cant recognize the class anymore. I've also tried importing the class like this

using User.Models



using System;
using System.Data.Entity;

namespace project.Models
{
public class User
{
public string email { get; set; }

public string username {get; set;}

public string password { get; set; }
}
}


What am I missing. When I leave the class in the root of the project with the namespace just ass my project name it works.

Continue reading...
 
Back
Top