|
|
Hi,
I know GC does memory management manually. If i want to manually reclaim the memory of an object, how can I do it.
Thanks
Devin
|
|
|
|
|
|
Then what does, GC.Collect() do
what is differnce between them
Devin
|
|
|
|
|
|
I think using GC.Collect we achieve finalization not memory reclaimation. Is I am right. Explain.
|
|
|
|
|
It will reclaim the memory. If an object requires it then the finaliser will be called first. The finalisation process is inefficient and objects that have finalisers will also have a Dispose() method. So, you should call Dispose() on an oject if it has that method. The Dispose() method will generally suppress the finalisation on that object making garbage collection more efficient.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Thka colin for your help.
|
|
|
|
|
hey everyone,
I've been searching for a way to get an array that includes every directory within a selected directory. say the parent directory was called "hello", I want to get every directory, even the directories within the directories returned. (i.e. hello/hieveryone/helloagain/). There is a "Directory.GetDirectories" method, but this only returns the directories immediately below the selected one. How do I get all the ones below that one, and below that one and send them to an array? all the levels below would be nice, but atleast a minimum of 12 levels below the directory. sry for the wordiness, I didn't know how else to word it. thanks a lot for your help!
|
|
|
|
|
You need to write a recursive function, that is, one that 'collects' all the directories within your main one, and calls itself for each, so it keeps drilling down.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Pyro Joe wrote:
How do I get all the ones below that one, and below that one and send them to an array?
By doing a recursive call like this:
public ArrayList Directories(DirectoryInfo startDir)
{
ArrayList list = new ArrayList();
DirectoryInfo[] dirs = startDir.GetDirectories();
foreach(DirectoryInfo dir in dirs)
{
list.Add(dir);
list.AddRange(Directories(dir));
}
}
See how the Directories() calls itself, but for the subdirectory.
Does this help?
DISCLAIMER: I typed the code directly in so there may be some syntax errors
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
yeah, thanks! I was gonna try to use a while loop, but that could get really complex logic-wise. but the foreach thing is really handy. thanks!
|
|
|
|
|
actually, there are two more arguements I just found out about. One that you can tell it to search ALL the subdirectories. but I still thank you for your time in answering my question.
|
|
|
|
|
I have some Problems please Help Me.
I am using Visual Studio 2002.
1. I want to display Images in Menu/Context Menu.
2. How to Hide taskbar and Desktop Icons.
3.How to Make form Topmost.(condition is that without closed that form you cannot select other items(forms).
using visual C#
|
|
|
|
|
1. I don't think there is an easy way to do this, but I could be wrong. Does the menu have an ownerdraw option ?
2. I don't think you can hide desktop icons at all, but any option you have will involve pinvoking shell functions. www.pinvoke.net is the best place for info on that stuff.
3. In C++, SetWindowPos made your window topmost, I'm not sure how else to do it in C#. Do you mean topmost, or do you mean modal ( where a dialog stops the rest of a program ) ? ShowDialog is how you get a modal dialog up in C#.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I am new to .net and was wondering if anyone could just guide me in the right direction about the support for an fax in .net. I need to write an App. which behaves like an e-mail to Fax. Any help is greatly appreciated. Thanks in advance!!
Regards,
DD
|
|
|
|
|
Ok, I'm ignorant here. Y'all know about DebugView, from SysInternals, right? How do I capture the output of Trace.Write... messages in another application, the way DebugView does?
Thanks!
Marc
My website
Latest Articles:
Undo/Redo Buffer
Memento Design Pattern
|
|
|
|
|
There doesn't seem to be any easy way to do this. Capturing debug/trace output for just you r application is easy, just derive a class from DebugListener/TraceListener and add it to the list of Debug/Trace listeners using Trace.Listeners.Add method. But capturing output from other apps seems to be quite difficult to do.
This[^] CP article might help. Also this[^] might help.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
Have a look at DBMon. It was an SDK tool with source code back in the day.
It can be downloaded here[^] or you'll probably have it in your platform sdk installation.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
|
Is there any way that I can start with a 2-character string, and find out if that is a valid 2-Character, ISO code for a localized language? For example, I have 'es' and I want to know that this is valid because it is the 2-character code for spanish. But 'oh' is not a valid language code.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
System.Globalization.CultureInfo.GetCultures();
Loop though the cultures and see if you find the two letter ISO code.
Obviously the two letter codes are not enough to identify a language, so be careful what you do with it.
|
|
|
|
|
Hi all,
I have a DataTable object and the 4th column has DateTime objects stored in it.
To get at the DateTimes i am doing the following.
DateTime dt;<br />
<br />
for (int x = 0; x < Table.Rows.Count; x++)<br />
{<br />
dt = (DateTime)Table.Rows[x].ItemArray[3]<br />
.....<br />
Some other code here<br />
.....<br />
}
Is there any way of getting at the DateTime object in the column without casting?
This is my biggest overhead by far in the method which is fine for a few hundred iterations
but sometimes i am going through tens of thousands of iterations and it's a tad slow.
Anyone able to help??
Cheers
Kev
|
|
|
|
|
When using the DataTable you will have to do the casting. One solution would be to take another data structure. You should also try not taking the ItemArray property as I think it produces a bit overhead (Im not 100% in this):
DateTime dt;
for (int x = 0; x < Table.Rows.Count; x++)
{
dt = (DateTime)Table.Rows[x][3]
.....
Some other code here
.....
}
|
|
|
|