[.net] C# Questions. ( List or LinkedList? Debugging? )

Started by
3 comments, last by HarryW 19 years, 3 months ago
Hello all, I have some questions. :) a) How can I enable debugging? ( VC# 2005 Beta1 ) b) What list/collection type should I use for a list of entitys/ collisions objects? List>Bla, LinkedList<Bla>, .. ? Thank you very much. Good bye! :p
Advertisement
As to Regular Lists (array based) vs. Linked Lists.

Linked lists perform very well when you are adding, removing and inserting elements and reasonably well when iterating through elements. They perform very poorly when you are randomly accessing elements.

Array based lists are just the oppsite: they perform very well for randomly accessing elements and iteration, not so well for adding* and very poorly for inserting and removing (except from the end).

*array based lists perform fine for adding (and removing) to the end of the list if you create them with a more than needed inital capacity.

For collision stuff you are probably better off with an array based list unless you are very careful about how you do your iteration.

Here is a discussion of linked lists that I found. Did not read the whole thing, but looked OK.
Quote:a)
How can I enable debugging? ( VC# 2005 Beta1 )

After your program has been built, hit F5 to run with debugging. You can use the Debug menu to set breakpoints, watch values, and things like that.

Quote:b)
What list/collection type should I use for a list of entitys/ collisions objects? List>Bla, LinkedList<Bla>, .. ?

Choosing the right collection class typicaly depends on three factors: first, how frequently you plan on accessing the data; second, how frequently you plan on modifying the data; and third, whether you require random access into the collection. For instance, if you will never be modifying the collection, then the right way to go is usually an array of the type. If you will be frequently modifying and reading from the collection and you require random access, a hash table might be the right way to go.

Can you describe in better detail what you'll be doing with the collection along these lines?
- k2"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {[email=kkaitan at gmail dot com]e-mail me[/email]} | {excellent webhosting}
a) It doesn't seem to work with my dlls. If I enable debugging only the.exe cam be debugged. "No iformation aviable".


b) Entity[] for a non changing list with random acess
List<Entity> for a non chaning list with random acess
LinkedList<Enitity> for a changing list. (Iteration only.)



Thanks ^^,

If you want to step into code in a DLL, you need to make sure you're linking with the debug version of that DLL. Also, for unmanaged DLLs, you need to enabled unmanaged debugging: if I remember correctly, go to Tools->Debugging in the menu, and check the 'unmanaged' option. I'd check that but Visual Studio isn't installed on the machine I'm using.
Harry.

This topic is closed to new replies.

Advertisement