How to Use Pointer in C# 2017 – C# Programming Example
General

How to Use Pointer in C# 2017

In Visual Studio, you create a new project and you want to use pointers in the project, Probably visual studio 2017 will give an invalid pointer error.

We need to open unsafe mode in the project because the pointers are unsafe codes. In Studio Visual Studio we will look at the pointer with a simple example.

Step 1: Let’s start Visual Studio 2017 and open a console application(you can also open wpf or winform).

Step 2: Right click on the project name and click properties in the solution explorer.

Step 3: Click Build tab and check “Allow unsafe code

 

Step 4: A Simple Pointer Example in C#

Add the unsafe keyword to Main method or Program class

 

 

 

 

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: