■
Note
In the examples that follow, I’m assuming that you have some background in C(++) pointer manipula-
tions. If this is not true in your case, feel free to skip this topic entirely. Again, writing unsafe code will not be a
common task for a vast majority of C# applications.
The unsafe Keyword
When you wish to work with pointers in C#, you must specifically declare a block of “unsafe code”
using the unsafe keyword (any code that is not marked with the unsafe keyword is considered “safe”
automatically). For example, the following Program class declares a scope of unsafe code within the
safe Main() method:
class Program
{
static void Main(string[] args)
{
unsafe
{
Do'stlaringiz bilan baham: |