You can use LINQ + int.Parse
:
int[] ipArray = lines
.Select(l => int.Parse(l.Split('/')[0].Split('.').Last()));
.ToArray();
This presumes that the format is strict, otherwise you get an exception at int.Parse
.
Here's a safer version:
int ip = 0;
int[] ipArray = lines
.Where(l => l.Contains('/') && l.Contains('.'))
.Select(l => l.Trim().Split('/')[0].Split('.').Last())
.Where(i => int.TryParse(i, out ip))
.Select(i => ip)
.ToArray();
If you instead want to find all 4 numbers of all IP's, so one array for every line:
int[][] allIPs = lines
.Where(l => l.Contains('/') && l.Contains('.'))
.Select(l => l.Trim().Split('/')[0].Split('.'))
.Where(split => split.Length == 4 && split.All(str => str.All(Char.IsDigit)))
.Select(split => Array.ConvertAll(split, int.Parse))
.ToArray();
Note that this is not IPv6 compatible ;)