|
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.
|
|
|
|
|
Thanks for the response Luc, well I'm rewriting a application into C# from C++ .... so that is the only reason I was asking.
Thanks again
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
the structs are value types and classes are reference types.
f(yf) = yf
|
|
|
|
|
|
Hi,
We, in our office use a remote Matlab License server running FlexLM license manager. Since we have very few floating licenses we end up asking to release the license from the fellow engineers many times a day.This creates confusion as we are not knowing who is actually using the license.
To automate this I plan to make a simple application wherein I'll monitor the connection to that particular matlab server and see which user has actually hooked up a license if a socket to that server:port becomes alive. Then I would start broadcasting to the rest of the users that this user is using the License.
This can be achieved my making a service that would feed a frontend application with the broadcast details which would let people actually know who is using the license. It is a simple License viewer.
Since I don't have administrative access to the license server (it is organization wide server) so I just can monitor connections from my system or from a group of users who actually install the service I am planning to make.
My only concern now is since I am to use broadcast mode for letting others know I have hooked up a license I would be in trouble with network bandwidth.
Does anybody have a better architecture to prevent the broadcast and use some other tricky method.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|