Jump to content
Xtreme .Net Talk

Recommended Posts

  • Administrators
Posted

Depends on what the res of your code is. Was this code a form, control etc? what class is it inheriting from?

 

All it does is call the base class' clean up methods when the class is ready to be garbage collected - so it depends on what the class is / base class is.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

I suspect it appeared when I added this:

 

Imports System.Math ' Need this to use Abs function

 

But I don't know for sure...

 

I'll leave it in for now.

 

>>>>Auto generated by VS<<<< I did'nt know it did this, thanks for the info

Posted

it's generated by vb.net

If you select your form's Overides, then select Finalize although the "MyBase.Finalize()" shouldn't appear, just the outter def-end def. Maybe someone else who worked on this code placed it there

mod2software

Home of the VB.NET Class Builder Utility - Demo and Full versions available now!

  • Administrators
Posted (edited)

Imports system.Math wouldn't cause this to be added.

 

A finalize method is use by the garbage collector to make sure non-managed resources get properly released when the object is no longer available. If the base class wraps any OS resource (file handle, window handle, memory mapped file etc.) then these resources are outside of .Net's control and cannot be garbage collected like a managed .Net object.

If your class implements the Finalize method then the garbage collector knows that the class needs special handling and will call the Finalize method a part of the garbage collection process - you would provide clean-up code for your non-managed resources there.

If the base class requires this then I would most definitely leave the auto generated code alone - deleting it could cause resource leaks and lead to general instability of the application.

Edited by PlausiblyDamp

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...