Interoperability: Namespaces, Assemblies and C++/CLI
11.1 INTRODUCTION AND OBJECTIVES
In this chapter we introduce a number of techniques to help developers organise their code and projects. The first ten chapters focused on language features, some design patterns and examples. When developing medium and large applications we shall need tools to organise our code base. In a sense the contents of this chapter are closely related to system management of applications. To this end, we discuss the following topics:
- Grouping classes into logically related namespaces.
- Designing and implementing software using assemblies and DLLs.
- Creating C# projects; multi-DLL projects.
- Attributes and the AssemblyInfo.cs file.
- Discovering assembly contents at run-time using the Reflection application programming interface.
This chapter can be read and used as a reference. In particular, the functionality in .NET allows developers to design and implement flexible component-based software systems. We consider many of the techniques in this chapter to be important when designing and implementing complex C# applications. We shall use them in future chapters when developing fixed income applications. In Chapters 20 to 23 we discuss the issue of C# and Excel interoperability.
In general, a namespace is a collection of logically related types. One immediate advantage of using namespaces is that we avoid name collisions – it is possible to define two namespaces, each one containing a class ...