Книга: C# 2008 Programmer

Using the Object Browser

Using the Object Browser

Because of the sheer size of the .NET Framework class libraries, it is always a daunting task for beginners using this framework to navigate through the large number of classes available. Fortunately, Visual Studio 2008 ships with the Object Browser, a utility that enables you to quickly search through the list of class libraries available in the .NET Framework.

To use the Object Browser (see Figure B-2), launch Visual Studio 2008 and choose View?Object Browser.


Figure B-2 

The left panel lists the assemblies (.dll files) available. You can expand on each assembly to view the namespaces contained within it.

Figure B-3 shows some of the information displayed by the Object Browser.


Figure B-3

You can expand a namespace to reveal the classes, delegates, and enumerations contained within it. Select a class and its associated members (methods, properties, events, and so on) are displayed in the top-right panel. Selecting a member of the class provides a detailed description of the member, such as its summary, parameters, and exceptions.

At the top of the Object Browser, you can select the list of components that you want to view (see Figure B-4).


Figure B-4

If the component you want to view is not listed in the Object Browser, select Edit Custom Component Set and choose the component you want to view in the Edit Custom Component Set dialog (see Figure B-5).


Figure B-5

The most useful feature of the Object Browser is its search capability. Say that you want to perform compression for your application and you are not sure which class to use for this purpose. Simply type a keyword (compression, for example) into the search box (see Figure B-6) and press Enter.


Figure B-6

The Object Browser lists all the namespaces, classes, and so on that are related to the keyword you entered. In this example, you can find the System.IO.Compression namespace that contains the classes you need to use (see Figure B-7) — DeflateStream and GZipStream.


Figure B-7

Clicking on a namespace shows you which assembly contains that namespace. System.IO.Compression, for example, is contained within the System.dll assembly.

Clicking an assembly link takes you to the assembly where you can examine all the namespaces contained with it (see Figure B-8). In this example, you can see that the System assembly is a member of the three versions of the .NET Framework — 2.0, 3.0, and 3.5. That's a useful feature because if you use an assembly that belongs only to .NET Framework 3.5, for instance, then you need to ensure that the computer running your application has the latest version of the Framework.


Figure B-8

Once you have selected an assembly, you can also click the Add to Reference button (see Figure B-9) in the Object Browser to add a reference to the assembly.


Figure B-9

Оглавление книги

Оглавление статьи/книги

Генерация: 0.032. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз