I agree with Shawn. Chris Sell's description is very helpful. I do not know
that it will answer you question, though.

I think that you actually meant to say type-safe *function*
pointers. Technically, I don't think that you want to think of them so much
as a pointer to a memory address as much as a reference to a method object.
In short, I believe that the answer to your question is that the CLR will
make sure that the pointers under the covers are managed as desired so that
if the method object is moved in memory for whatever reason, the delegate
reference will still remain valid.

Hope that helps,
Jef
http://integralpath.blogs.com

On 7/9/06, Shawn Wildermuth <[EMAIL PROTECTED]> wrote:

I would not think of them as type-safe pointers as such.  My suggestion is
to read Chris Sells' Delegate Bedtime Story[1].


Thanks,

Shawn Wildermuth
Wildermuth Consulting Services, LLC
http://adoguy.com
C# MVP, MCSD.NET, Author and Speaker

[1]
http://www.sellsbrothers.com/writing/default.aspx?content=delegates.htm

> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of John Whattam
> Sent: Sunday, July 09, 2006 6:27 PM
> To: [email protected]
> Subject: [ADVANCED-DOTNET] Delegates And Memory Rearrangements
>
> I have read up on all I can regarding delegates in NET. All
> documentation refers to them as being type-safe pointers. As
> such they hold a pointer to a memory address. I am using a
> delegate as a pointer to a callback for the
> EnumFontFamiliesEx API. If the garbage collector collects
> objects that are completely unrelated to the object holding
> the delegate and thus rearranges objects in memory, is the
> address pointed to by the delegate updated to reflect the new
> memory location of the callback function or does it still
> point to the original memory location specified when the
> delegate was instantiated?
>
> Regards,
> John Whattam.
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to