Learn C# Hashtables by Adding, Removing, Updating, Looping Through User Info

17
3



Hey! We have some links for you!

Code IDE

Hashtable Reference

Intro Tunes

Today you’re going to learn about the c# hashtable. Darren uses an example with holding millions of usernames in a hashtable versus millions of usernames in a list and reveals the beauty of using hashtables for object lookups.

A hashtable is a collection datatype in C#. It is organzied by Key Value Pairs, where the key is like an index, and the value is what is returned by searching for a particular key. Value = Hashtable[Key]. You will learn how to add, remove, update, and loop through a hashtable using C#.

Thanks for stopping by!

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

17 COMMENTS

  1. Loved the tutorial. Have a question, I'm sorry if this is too basic. Why did we have to declare userInfoHash and sw outside the main function?

  2. What if you need to search by value? Like where in the hash table is a username vs where in a list is the username? Both would require looping because you didnt use a special function for generating the hashkey.

  3. it's an awesome video~!! I've just subscribed ur channel. By the way, I have two questions.
    1. if Hashtable is not generic type, then I must assign Keys and Values into Hashtable directly ( cuz it could contains any type of object ?) unlike Generic Collection type?
    For example, if I declare List<UserInfo>, then I can add or remove <UserInfo> type.

    2. I'm using Visual studio as IDE, what's benefits from Xamarin?

  4. I think your code could possible fail. You define 4,000,000 elements, which is an index range of [0, 3,999,999], and then generate a random int with a maximum of 4,000,000. Although highly unlikely… you see where I'm going.

  5. But the list object also has access by index. Wouldn't it be the same performance as the Hashtable example? Check this link https://msdn.microsoft.com/pt-br/library/0ebtbkkc(v=vs.110).aspx

  6. Besides the information, I enjoyed the very fast typing which resembled (to me) the sound of a centipede crawling across the ground. looll, also, this screams card game programming! I'll be watching this a lot :d

LEAVE A REPLY

Please enter your comment!
Please enter your name here