Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

Though the common language runtime always aware the code


Chapter 35 ■

Using Unsafe Code and Pointers

*myNumberPtr can be read as “the integer located at the memory value address held by myNumberPtr.”

Finally, pointers can also be declared for structs.

This can be done with the following code:


int* int1, int2;

Those developers would assume that int1 is a pointer to an integer, and int2 is just an integer. C# handles this statement differently, as the pointer declaration is on the type, not the variable. In this example, both int1 and int2 are pointers to integers.

Aside from placing code within an unsafe construct, you must also configure the compiler to allow unsafe code to be used. This can be done through the property pages for the project or by using the /unsafe switch flag with csc.exe.

The following code shows how to properly use the unsafe keyword in a couple of ways.

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELIC568AEA
Uploaded by :
Page 1 Preview
though the common language runtime always aware th
Sell Your Old Documents & Earn Wallet Balance