Structuring the Files in Our Project Using Namespaces

A free video tutorial from Tod Vachev
Best Selling Instructor 100,000+ Students, Robotics Engineer
17 courses
297,009 students
Learn more from the full course
Basics of Object Oriented Programming with C#
This course will introduce you to the Basics of OOP with C#, followed by a Project to Practice - Warrior Wars!
01:35:29 of on-demand video • Updated September 2020
Basic Concepts of Object Oriented Programming with C# (but the concepts apply to most languages)
Namespaces
Fields & Properties
Const and Readonly constants
Static Fields
Static Classes (Singleton)
Enumerations
English [Auto]
Let's extract our claws into a separate file and see what exactly is a name space. So right click on our project Select up and select class name the class list name and point you name the class file with the name of the clause that it's going to contain. So let's do it and let's just copy and paste our class from here. All right. Let's. It's perfect. So now we have our class in a separate file. You can see that it's still working. We still have access to that class even that it's now in a separate file. What we're going to do now is we were going to create a new folder in our project a new folder and let's call it points and lines for winds from the sample just some arbitrary name and move our CROSSFIRE inside that folder. We are now going to add a namespace namespace for that class and namespace the name of the folder. Points and lines and tell them to move everything inside. And now when we go back to our main class we can no longer access the point file if we want to ox's is what we have to do is that we have to write using points and lines. So this is what the namespace is the namespace lets you organize your class files in a bigger project. You may have several different folders each of them may have its own folder and by a namespace to your classes you can easily organize them and access them whenever you use their namespace. This is why when we try to use the Cazotte was we tried using system because the console class is inside the System namespace the System namespace has several different classes one of which is the console quas the trip Chua's that we use to create the balls in our code is located in that system of trading which means that trading is us namespace inside the System namespace like this using system and compress dot system is a namespace on its own. But we thought that we get the Supe namespace is inside the System namespace and you can see that here we have many other name spaces. So basically this is all the namespace is Ethiope to organize are code better. But all the namespace does.