Over 10 Million Study Resources Now at Your Fingertips


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

Though the common language runtime always aware the code

396

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:

(*coordPtr).y;

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
Payment
Make payment
Document download
Download File
PageId: ELIC568AEA
img
Uploaded by :
PWPKeNGM
Page 1 Preview
though the common language runtime always aware th
Sell Your Old Documents & Earn Wallet Balance