Pointers in C#?
So I've heard that pointers, although usable in C#, aren't exactly what people would use in it. I am, however, still interested in learning basic syntax for it. Does anyone know how or what to do?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
dilipv vishwakarmaPosted Mar 5, 2008, 2:21 AM
hi there,
A pointer is a variable that holds the memory address of another type. In C#, pointers can only be declared to hold the memory addresses of value types (except in the case of arrays ).
Pointers are declared implicitly, using the 'dereferencer' symbol *, as in the following example:
[Note that some coders place the dereferencer symbol immediately after the type name, This variation appears to work just as well as the previous one.]
There several article based on it. You need to make detailed study about it. Just checkout the given links as follows.
Hope this will help you.
Thanks & Regards
Dilipv
SharePoint Consulting
J ElasiguePosted Mar 4, 2008, 2:41 PM
AlanPosted Mar 4, 2008, 2:22 PM
You can only use pointers in C# within what's called an 'unsafe' context. As it's too large a subject to cover in a few lines, can I refer you to these three links for more details:
http://msdn2.microsoft.com/en-us/library/t2yzs44b.aspx
http://69.10.233.10/KB/cs/unsafe.aspx
http://www.c-sharpcorner.com/UploadFile/PatrickSmacchia/CSharp2UnsafeCode02162006063859AM/CSharp2UnsafeCode.aspx