Namespaces and using directives
📖 Scenario: You are organizing a small program that prints messages from different parts of a company. Each part has its own namespace to keep things tidy.
🎯 Goal: You will create namespaces and use using directives to access classes inside them easily. Finally, you will print messages from each namespace.
📋 What You'll Learn
Create two namespaces named
Company.Sales and Company.SupportInside each namespace, create a class named
Message with a method GetMessage() that returns a stringCreate a
Program class with a Main methodUse
using directives to access the Message classes from both namespacesPrint the messages returned by
GetMessage() methods from both namespaces💡 Why This Matters
🌍 Real World
In real software projects, namespaces keep code organized and prevent conflicts when many developers work together or when using third-party libraries.
💼 Career
Understanding namespaces and using directives is essential for writing clean, maintainable C# code in professional development environments.
Progress0 / 4 steps