C# for Java Programmers

Chapter 9: Attributes and Assemblies

Introduction

One of the features of the Common Language Runtime (CLR) is that any types built for the CLR with any .NET languages can be shared among other applications in the Microsoft .NET Framework. In this section we will look at building, packaging, and deploying applications for the .NET Framework. More specifically, we will learn about attributes and assemblies.

The first part of this chapter will look at attributes. Attributes are used to give extra information to the .NET compiler. Java uses a combination of /** and @ tag comments for including additional documentation information about classes, methods, fields, and even individual parameters. However, this information is not included as parts of the bytecode after you compile your class. With attributes you have the ability to provide custom information about any element of your code that gets compiled as part of your program. This information or metadata can then easily be retrieved at runtime through a process known as reflection.

The second part of the chapter will look at assemblies, which are C# s version of packaging. Assemblies are .exe s or . dll s generated from compiling a project of files. The .NET runtime uses the configurable attributes and versioning rules built into assemblies to greatly simplify application deployment. Finally, you will learn about versioning, which will prevent a common Windows application development problem referred to as DLL Hell.

Working with Attributes

The most useful thing to know about attributes is that the information supplied in the attribute is...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Cylindrical Lenses
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.