C# Developers' Journal (original) (raw)

C# Developers' Journal [Most Recent Entries] [Calendar View] [Friends View]

Tuesday, June 20th, 2006

Time Event
10:23a C# program with memory issues I'm writing a program in C# 1.1 that extracts documents from our current database to be then transferred into our new content manager/collaborator or whatever. Anyways I have basically written the program and it successfully extracts the documents that I tell it to, but the problem is that its a major memory hog, and when I monitor the memory and the heap size it is just staggering. The problem is that I basically have loops that are going and grabbing sometimes hundreds of documents at a time, and when the documents are over 1mb in size it almost starts to get scary. I should also point out that I've never written a program like this before and I have learned more about programming and memory management than I ever cared to know. I don't know if there's anything I'm programming wrong, or if I'm not releasing resources correctly. My "expertise" is more in Web development than this, and it doesn't help that not alot of people at my company know C#. Anyways below is the code I have for grabbing multiple documents.**( CodeCollapse )**I'm sure this code isn't great, but at the very least it WORKS. Now I need to clean it up so we can run this in a production environment. Thank you. Current Mood: determined
1:45p A Collection of Objects (ArrayList, Hashtable, etc) Hello,I'm trying to create a hashtable or arraylist of objects of classes, which I wrote myself earlier.so I have:class myClass{ myClass() { //blah } myMethod() { //stuff }}myClass myClassInstance = new myClassInstance;ArrayList list = new ArrayList();list.Add(myClassInstance);// So here I'm trying to run a method from the list.list[0].myMethod();Here, I get an error, that an Object class does not have "myMethod". So, C# doesn't recognize that it's not an Object in the list, it's MyClass. How can I make a collection of my own objects, so that I can use their methods like that? Sounds like it has something to do with the rules of polymorphism in C#, which I don't know, as I'm used to template system of C++.Thanks.
6:04p Total Newbie Question Hi!I'm not *totally* new to Visual Studio, but I stopped concentrating on programming a long time ago, and now it's time to start again as I need things for my Uni course.So... I've just installed Visual Studio 2005 for the first time.And... I've got a nice book about C#.And it tells me to open up Visual Studio and select Visual C# Development Settings from the list it shows on the first time of opening VS.But... I opened it up earlier and wasn't sure about that list, so I just closed it. And that list isn't available anymore.But I followed the book's instructions, and it's definitely not a C# project.It seems to be in VB.So my question is, how do I get that list back to choose C#?I'm really sorry for the total newbie question. Hopefully I'll be asking more serious coding questions soon! Current Mood: Stupid