I'm wondering if anyone can give me a good example of using pointers in C# in .Net and why you chose to use pointers?
-
What do you mean by "using pointers", are you trying to call some unmanaged code?J.W.– J.W.2009-04-08 17:39:46 +00:00Commented Apr 8, 2009 at 17:39
-
I'm just learning about pointers and wondering how they might apply to web development. Since I'm working in .Net, I thought I'd limit it to that.madcolor– madcolor2009-04-08 17:44:38 +00:00Commented Apr 8, 2009 at 17:44
3 Answers
This isn't really a question to specific to ASP.NET.
If you are going to use pointers in .NET, the predominant reason is that you have an interop scenario where it is going to be easier to use pointers in unsafe code instead of IntPtr instances.
The second most popular (and distant) reason is because you might actually have a performance gain in processing large amounts of data in unsafe code than in managed code. Image processing algorithms are a good example of this.
3 Comments
If you wanted to do some performant image processing for a web application, you might want to consider using pointers there. See Image Processing Basics in C# on codeproject.com.
1 Comment
You only need to use pointers if you're using unmanaged code, or making pinvoke calls.
1 Comment
unsafe C# at all (by using IntPtr)