26

.NET Assemblies

If you are reading this book just to learn about the C# language, you can now skip to the next chapter. This chapter is an “under-the-hood” look at how the Microsoft C# compiler packages your C# code when it is compiled into an executable format. The chapter will help you understand how your C# code makes calls into the .NET Framework system classes and how other programs can call your code when you make a class library. Also, if you are planning to make a C# program that will be distributed as a commercial software product or even deployed on many computers within your organization, then the material in this chapter will be very important to understand. But if you are just making a C# program for a student project or your own personal use, then much of what follows here will be interesting, but not necessary to your use of Visual C#.

When your C# program is compiled, it is packaged into an assembly. An assembly is a .NET executable program (or part of an executable program) delivered as a single unit. It is a file or set of files containing a .NET program or resources supporting a program. When you build a C# Windows or console application, the .exe file produced is an assembly. If you build a class library, the DLL (Dynamic Link Library) file produced is also an assembly.

All the code in an assembly is built, delivered, and assigned a version number as a single unit. The assembly makes the public classes, properties, and methods visible to other programs. Everything ...

Get Beginning Visual C#® 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.