I want to exit when the result is true using ipnetwork. It exits from foreach, but it doesn't get out of the List and runs again. please tell me how to solve.
Is there a way to do this without using ActionableList? Or is there a better way to code? This is the .net 5 version.
What I am trying to do is to set true if the IP address is included in the allowable range among the registered IP addresses.
bool result = false;
await Task.Run(() => {
var q = ss.CreateCriteria<Ip>();
q.List(new ActionableList<Ip>(r => {
var ipArray = JsonConvert.DeserializeObject<List<string>>(r.ip_address);
foreach(var ip in ipArray){
IPNetwork ipnetwork = IPNetwork.Parse(ip);
result = ipnetwork.Contains(ipaddress);
if(result){
return;
}
}
if(result){
return;
}
}));
});