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

UNSAFE CODE Appendix A 841

3.In the right pane, select the Configuration Properties option.

4.Change the value of Allow unsafe code blocks property in the Build option to True.

The default value of this property is False.

5.Click on the OK button to close the Property Pages page.

Figure A-1 shows the Allow unsafe code blocks option.

FIGURE A-1 Allow unsafe code blocks option

Summary

In this chapter, you learned about pointers. A pointer is a variable similar to a reference and points to an address in memory. A pointer stores the actual memory address and makes it available to you. Pointers are extensively used in C and C++ for dynamic allocation of memory and to directly access the memory. Working with pointers requires extensive programming. Therefore, C# allows you to use pointers only within blocks of code for which the pointer is required. You can use the unsafe keyword to mark the block of code in which you need to declare a pointer.

Then you learned about the classification of code in C#. All program code in C# is classified as managed or unmanaged code. Managed code contains some information about the code.This information contained in the managed code is called

842

Part X

APPENDIXES

 

 

 

metadata.The code that is marked with the unsafe keyword is called unmanaged code. The unmanaged code does not contain metadata.

Next, you learned about the operators used with pointers.These operators include

the indirection operator, the address operator, the sizeof operator, the stack-

alloc operator, the -> operator, and the [] operator. Finally, you learned about the commands used to compile the code that uses pointers.

Appendix B

Introduction to Visual Basic .NET