T
T
TechNOIR2018-12-25 14:31:39
C++ / C#
TechNOIR, 2018-12-25 14:31:39

WITH#. How to get a specific IP starting with 10 from a List System.Net.Dns.GetHostEntry(hostname).AddressList object?

Good afternoon!
I get a List of addresses using System.Net.Dns.GetHostEntry(hostname).AddressList, there are a lot of ipv6 addresses, addresses like 192.168.XX and among them there is one 10.XXX
How to get it from the list?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-12-25
@alexr64

System.Net.Dns.GetHostEntry("ya.ru").AddressList.First( x=>x.Address.ToString().StartsWith("10"))

G
GavriKos, 2018-12-25
@GavriKos

Loop through the entire List and select the one you need, don't you? What's inside the sheet? string?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question