C
C#2y 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 User2y ago
Message Not Public
Sign In & Join Server To View
GNUGradyn
GNUGradyn2y ago
omg why didnt i think of that lol, thanks
Accord
Accord2y ago
✅ This post has been marked as answered!