473,325 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

What does the syntax"~[Class name]" mean?

Hi everyone,

I got a question about a syntax in c# which I'm not
familiar with.

And then I've got some sample source code as shown below.

public class Window: System.Windows.Forms.Form
{
public Window(){
// some code here
}

~Window()
{
windowFont.Dispose();
}
}

Is that the symbol ~ which prior to the class name identify
the beginning of dispose method?

Anyone've got an idea?
Regards,
Sarun Sermsuwan

May 19 '06 #1
2 2608
Optimus wrote:
Hi everyone,

I got a question about a syntax in c# which I'm not
familiar with.

And then I've got some sample source code as shown below.

public class Window: System.Windows.Forms.Form
{
public Window(){
// some code here
}

~Window()
{
windowFont.Dispose();
}
}

Is that the symbol ~ which prior to the class name identify
the beginning of dispose method?

Anyone've got an idea?
Regards,
Sarun Sermsuwan

It indicates the finalizer(destructor) method.

JB
May 19 '06 #2
Hello Optimus,

It's destructor, that calls Finilize
See description there http://msdn2.microsoft.com/en-us/library/66x5fx1b.aspx

O> And then I've got some sample source code as shown below.
O>
O> public class Window: System.Windows.Forms.Form
O> {
O> public Window(){
O> // some code here
O> }
O> ~Window()
O> {
O> windowFont.Dispose();
O> }
O> }
O> Is that the symbol ~ which prior to the class name identify the
O> beginning of dispose method?

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jian H. Li | last post by:
Hello, What's the essential differences between the two ways of "class::member" & "object.member"(or object_pointer->member)? class C{ public: void f() {} int i; };
3
by: Joseph | last post by:
I read a piece of code, and the code looks like the following part. CWnd is a MFC class class CFrameGrabber : public CWnd { .... }; BOOL CFrameGrabber::Create(int x, int y, CWnd...
9
by: Xiangliang Meng | last post by:
Hi, all. I see a very strange fragment code today. Uint32 enum { a = 100; b = 200; }; NOTE: Uint32 is defined to be 'unsigned' in other source files.
8
by: kevin | last post by:
I have a form and in the form I have a sub that uses a class I instantiate using visual basic code: Public oCP As New Rs232 'instantiate the comm port I need to share this sub with...
38
by: looping | last post by:
For Python developers around. >From Python 2.5 doc: The list of base classes in a class definition can now be empty. As an example, this is now legal: class C(): pass nice but why this...
39
by: utab | last post by:
Dear all, Is there a clear distinction how to decide which functions to be members of a class and which not How is your attitude (Your general way from your experiences ...) "If the...
1
by: BobPaul | last post by:
I'm following code out of a howto book and this is really bugging me. This header file was created by VStudio 6.0 when I did a "Right Click: Add Member Function" CLine is a class I wrote (per the...
4
by: rebeccatre | last post by:
please help me with this, <style> #a, option.message {background-color: green; color: white;} #b, option.message {background-color: yellow; color: black;} </style> <select id="thisselect">...
4
by: david.karr | last post by:
I'm a CSS newbie, but I was browsing through the css files in the YUI library, and I noticed the following line: body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.