Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft C# Professional Projects - Premier Press.pdf
Скачиваний:
177
Добавлен:
24.05.2014
Размер:
14.65 Mб
Скачать

82

 

Part II

HANDLING DATA

 

FIGURE 4-2 Ouput of the previous code

Summary

In this chapter, you learned about arrays and collections. An array is a data structure used to store a number of variables and has one or more indices attached to it. A collection is defined as a group of objects that you can access using the foreach loop. An array is a special type of collection in C#. Next, you learned about indexers, which are members that allow you to access objects as if they were the elements of an array.

This chapter also covered techniques to type cast variables into objects and vice versa. To do this, you used the techniques of boxing and unboxing. Boxing is used to convert a value type to a reference type. Unboxing does the opposite, by converting a reference type to a value type. Finally, you learned about preprocessor directives in C#. These directives are commands that are not executed by the C# compiler. However, these commands affect the process of code compilation.

Chapter 5

Attributes

and Properties