Check if section / key exist
See original GitHub issueHey,
Is there any ways to check easily if a section, or a key exist? Included into this awesome libs, or on my side?
EDIT: Found my issue.
I got an error on:
bool move = conf["Settings"]["move"].BoolValue
saying the instance isn’t define to an object.
I fixed it on my side by making a weird workaround, such as:
bool move = Convert.ToBoolean(conf["Settings"]["move"].StringValue);
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Check if a given key already exists in a dictionary
I wanted to test if a key exists in a dictionary before updating the value for the key. I wrote the following code:...
Read more >How to check if a key exists in a Python dictionary
has_key method. The has_key method returns true if a given key is available in the dictionary; otherwise, it returns false.
Read more >Check whether given Key already exists in a Python ...
Check If Key Exists using has_key() method ... Using has_key() method returns true if a given key is available in the dictionary, otherwise,...
Read more >Check if Key Exists in Dictionary Python
You can check if a key exists in a dictionary in Python using Python in keyword. This operator returns True if the key...
Read more >Check Whether a Given Key Already Exists in a Dictionary ...
Therefore, it is a safe practice to check whether a given key already exists in the dictionary or not before trying to get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey there! Sure, you can check if a section or setting exists using the Contains method. The Configuration class has a Contains(string sectionName) and Contains(Section section) method. The Section class also has these methods, but for settings.
Could you explain the error please?
What exactly is not working here?
Cheers!
Alright, the new version (1.5.3) is up. Cheers! 😃