© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
12 replies
mack

Finding Index of Dictionary Key

hey guys, just joined the server so forgive me if im not asking in the right place... please direct me elsewhere if this isnt the right area
i am making an inventory system using a
Dictionary<int, int>
Dictionary<int, int>
(key is for item ID, value is for how many of that item you have) and i was just curious about something:
if (GameDataManager.Instance.inv.ContainsKey(ID))
{
  // get index of key ID
}
if (GameDataManager.Instance.inv.ContainsKey(ID))
{
  // get index of key ID
}

does that make sense? i want to know if
ID
ID
is already in
inv
inv
so that, if it is, i add 1 to the value, and if not, i Add() the ID
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Chunking both key and value from dictionary
C#CC# / help
2y ago
❔ Cant Find Key Type Byte In Dictionary?
C#CC# / help
3y ago
Dictionary Implementation, but with custom class as key
C#CC# / help
4y ago