|
|
Hello everyone,
In my understanding, this method only prevents GC from invoking Finalize method of the instance, it does not prevent GC from reclaiming the memory consumed by the instance? Right?
thanks in advance,
George
|
|
|
|
|
SuppressFinalize is used to prevent the call to the finalizer, usually after you cleaned up you resources in the Dispose method.
The call removes the object from the finalization queue, so it is destroyed earlier (and the GC may reclaim memory on it).
So yes, you're right.
|
|
|
|
|
Thanks Zoltan!
I noticed that when dispose method is called, we always call SuppressFinalize to prevent from calling Finalize again.
So, it means we should do the same thing (resource de-allocation) in both Dispose and destructor, right?
regards,
George
|
|
|
|
|
It prevents you from cleaning up unmanaged resources twice. The GC will still (always AFAIK) free the managed memory on Finalize.
|
|
|
|
|
Thanks leppie!
I noticed that when dispose method is called, we always call SuppressFinalize to prevent from calling Finalize again.
So, it means we should do the same thing (resource de-allocation) in both Dispose and destructor, right?
regards,
George
|
|
|
|
|
George_George wrote: So, it means we should do the same thing (resource de-allocation) in both Dispose and destructor, right?
Basically, normally you would use the Dispose(bool) pattern that will be called from the Finalizer with a false parameter, where Dispose() calls it with a true parameter. Do a search, you are bound to find more than enough samples.
|
|
|
|
|
Thanks leppie!
I have made some research. I think in destructor, we should call Dispose to release native resource, in Dispose, we should release both native resouce and call Dispose method of wrapped managed resource explicitly. Right?
regards,
George
|
|
|
|
|
hey
any one of u can help me..
i have one pdf file with 4-5 pages and i want to save these pages as images.so i can show these pdf pages in thumbnail .i m using C# in asp.net application.
can any one help me.can any one give me code help.
thx
Ajay Rathi
software engineer
NOIDA(UP),INDIA
|
|
|
|
|
Hi,
What are the maximum number of columns in .NET DataTable.
Thanks in advance
|
|
|
|
|
|
If you have to hit that limit, you've got bigger issues with your application...
It's System.Int32.MaxValue , or 2,147,483,647. But since you wont be able to reach that limit without generating an OutOfMemory Exception, it's limited by available memory.
|
|
|
|
|
|
|
Can we increase size of data table? I am trying to read data from Excel but dataset picks only first 256 column How Can I read all data from Excel
|
|
|
|
|
|
Hi there, sorry about the n00b question but i've really not been able to find an answer on google. What is the easiest way to distribute an application created in visual studio with an installer that will automatically install requirements/prerequisites for the application such as the .net framework? Can I not include necessary files with the exe or the installer?
Kind regards
Linden
|
|
|
|
|
Don't quote me on this, been a while since I did this, but I believe you need to add a setup project to your solution, and you add the prerequisites such as .net framework to that project.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
use third party installer program...its bit easy..it automatically asks what prerequisites must be there and install if not found..
i have tried WISE installer
Ashish Sehajpal
|
|
|
|
|
I have added 10 combobox in column "B" for 10 different rows.i have added 10 EventHandler for each combobox but when the event fire of one of combobox ,it fires in the 10 combobox.
bellow is the code i used:
private void Sheet2_Startup(object sender, System.EventArgs e)
{
for (int i = 0; i < 10; i++)
{
String rowIndex = (i + 5).ToString();
Microsoft.Office.Tools.Excel.Controls.ComboBox cmbItemName = this. Controls.AddComboBox(this.Range["B" + rowIndex, "B" + rowIndex], "cmbItemName" + rowIndex);
cmbItemName.DataSource = mItemTable;
cmbItemName.DisplayMember = mItemTable.Columns["name"].ColumnName;
cmbItemName.ValueMember = mItemTable.Columns["uid"].ColumnName;
cmbItemName.DropDownStyle = ComboBoxStyle.DropDownList;
cmbItemName.SelectedItem = null;
cmbItemName.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
}
}
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
Microsoft.Office.Tools.Excel.Controls.ComboBox cmbItemName = (Microsoft.Office.Tools.Excel.Controls.ComboBox)sender;
String itemUid= cmbItemName.SelectedValue.ToString();
}
modified on Tuesday, April 15, 2008 9:07 AM
|
|
|
|
|
Hi all,
How can I perform the following C++ structure code within C#?
struct EmpStruct
{
char name[15];
char surname[15];
}EMP[100];
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Is this correct:
public struct EMP
{
public string name;
public string surname;
}
....
EMP [] employee = new EMP[100];
....
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
(It is )
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
No, not yet ... but according to some code snippets I saw on the web it looks like it will work.
Thanks for the response.
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
there is a difference:
in unmanaged C/C++ the struct EmpStruct has a size of 30 (or 32), since it contains 30
characters.
your C# struct has a size of 8 (or 16 on Win64) since it contains two references and
no characters.
So it all depends what you are trying to do:
- if you are porting a C/C++ app to C#, it could be good enough;
- if you want your C# to cooperate with existing software or hardware that needs the
original struct EmpStruct, then it is not OK, and you will need special Marshalling
instructions.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|