1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How To Modify An Element in the Dictionary Class?

Discussion in 'Software Development' started by Bill_Thompson, Aug 18, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. Bill_Thompson

    Bill_Thompson Thread Starter

    Joined:
    Mar 23, 2007
    Messages:
    24
    How To Modify An Element in the Dictionary Class?
    =======================================

    C# has this cool Dictionary class that you can use like a Hash Table. Is there a way of changing the value of an indexed element without resorting to removing it like this?
    Code:
                   int value = runningcount[city];
                   runningcount.Remove(city);
                   runningcount.Add(city, ++value);
     
  2. Aftab

    Aftab

    Joined:
    Oct 15, 2003
    Messages:
    72
    runningcount[City] = ++runningcount[City]
     
  3. Bill_Thompson

    Bill_Thompson Thread Starter

    Joined:
    Mar 23, 2007
    Messages:
    24
    Yep!
    Thanks !
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1065635