Use the Dictionary class. It should do what you need. Reference is here.
So you can do something like this:
IDictionary<string, int> dict = new Dictionary<string, int>(); dict["red"] = 10; dict["blue"] = 20;
Related Posts:
- Convert HTML to PDF in .NET
- C# HttpClient An existing connection was forcibly closed by the remote host
- Can anyone explain IEnumerable and IEnumerator to me? [closed]
- IOException: The process cannot access the file ‘file path’ because it is being used by another process
- Getting mouse position in unity
- Error : Index was outside the bounds of the array.
- No connection could be made because the target machine actively refused it?
- What does a lock statement do under the hood?
- What is C# equivalent of
- ASP.NET 5 MVC: unable to connect to web server ‘IIS Express’
- What is the purpose of nameof?
- Converting a String to DateTime
- Why is this code throwing an InvalidOperationException?
- How to add a default Default.aspx to a ASP.NET Web Application Project?
- Regex for numbers only
- Access to the path is denied
- What does question mark and dot operator ?. mean in C# 6.0?
- How to jump in Unity 3d?
- The client and server cannot communicate, because they do not possess a common algorithm – ASP.NET C# IIS TLS 1.0 / 1.1 / 1.2 – Win32Exception
- ToList().ForEach in Linq
- Cannot implicitly convert type ‘customtype’ to ‘othercustomtype’
- Metadata file ‘.dll’ could not be found
- Proper way to initialize a C# dictionary with values
- Unity 2d jumping script
- Get dictionary value by key
- Invalid URI: The format of the URI could not be determined
- Unity “The associated script can not be loaded” and “Win32Exception: The system cannot find the file specified”
- Convert Linq Query Result to Dictionary
- Get single value from dictionary by key
- What is the difference between “@Scripts.Render” and “
Recommended Hostings
Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.
FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.