By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,693 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,693 IT Pros & Developers. It's quick & easy.

Pointers in VB.NET??

P: n/a
I am a little bit confused so am proposing this question.
Thanks in advance to anyone who can answer it for me.

I was told many times that one of the things that .NET got
rid of was pointers. So for the past year and a half I
have been running under this assumption.

Today I ran into something called an "IntPtr" which is a
structure that acts as... a pointer!! (This is in VB.NET,
I imagine it is everywhere then)

What's the deal then? I take it you can use pointers
in .NET?

I see a common use for IntPtr is to act as a handle (the
example given in the documentation is for file handles for
System.IO classes) but can these be used like C++ pointers?

Thanks!
~IC
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
: but can these be used like C++ pointers?

In what way do you mean? In syntax, like &var and *var? Then no.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Maybe it's a game called 'Punish the User'"
"IcedCrow" <ch********@aol.com> wrote in message
news:00****************************@phx.gbl...
: I am a little bit confused so am proposing this question.
: Thanks in advance to anyone who can answer it for me.
:
: I was told many times that one of the things that .NET got
: rid of was pointers. So for the past year and a half I
: have been running under this assumption.
:
: Today I ran into something called an "IntPtr" which is a
: structure that acts as... a pointer!! (This is in VB.NET,
: I imagine it is everywhere then)
:
: What's the deal then? I take it you can use pointers
: in .NET?
:
: I see a common use for IntPtr is to act as a handle (the
: example given in the documentation is for file handles for
: System.IO classes) but can these be used like C++ pointers?
:
: Thanks!
: ~IC
Nov 20 '05 #2

P: n/a
"IcedCrow" <ch********@aol.com> schrieb
I am a little bit confused so am proposing this question.
Thanks in advance to anyone who can answer it for me.

I was told many times that one of the things that .NET got
rid of was pointers. So for the past year and a half I
have been running under this assumption.

Today I ran into something called an "IntPtr" which is a
structure that acts as... a pointer!! (This is in VB.NET,
I imagine it is everywhere then)

What's the deal then? I take it you can use pointers
in .NET?

I see a common use for IntPtr is to act as a handle (the
example given in the documentation is for file handles for
System.IO classes) but can these be used like C++ pointers?

Thanks!
~IC

Pointers and pointers are not the same. ;-) In VB.Net there are no pointers
in the sense of C++ pointers. But, of course, references to objects located
somewhere in memory must be stored. As they point to the object these
references could also be called "pointers", but acutally we call them
"variables declared as a type that is a reference type". An IntPtr is
usually only used with Interop, i.e. when calling unmanaged API functions.
They must be there because not everything can be done in the managed world
and because the managed world is built upon the unmanged world.
--
Armin

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.