C
C#3y ago
GNUGradyn

How do I check if a list in an IConfiguration has any values [Answered]

I am trying to do this
if (_config.GetValue<bool>("AutoRegisterSlashCommands:Dev") && _config.GetSection("DevServers").Get<ulong[]>().Any())
if (_config.GetValue<bool>("AutoRegisterSlashCommands:Dev") && _config.GetSection("DevServers").Get<ulong[]>().Any())
However this throws an ArgumentNullException if the configuration section is an empty list
3 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
GNUGradyn
GNUGradynOP3y ago
omg why didnt i think of that lol, thanks
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server