I have 2 string arrays, and I would like to return if any of them exists in _authRole array. How is that done?
string[] _userRoles = userdata.Split(',');
string[] _authRoles = AuthRoles.Split(',');
bool isAuthorized = _authRoles.Any(_userRoles ??);
/M
If what you want is to determine if _authRoles
and _userRoles
have at least one common item, then use:
bool isAuthorized = _authRoles.Intersect(_userRoles).Any();
You can also query the result of Intersect
in any other way you choose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With