Dofactory.com
Dofactory.com

How to get a dictionary value by key in C#

Use the key name on the indexer of the dictionary, like so:


var dictionary = new Dictionary<string, string>();

dictionary.Add("CompanyId", "471413bf-a831-4e4a-bc3f-16492254d1b5");

string id = dictionary["CompanyId"];


Jack Poorte
Jack Poorte
Last updated on Sep 30, 2023



Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.