Sign in to follow this  

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

This topic is 4734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 ^^,

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this