There are two ways to do it:
1) Run "ipconfig /all" in a process, capture the output and parse it to obtain the bite you want:
Process.StandardOutput Property (System.Diagnostics) | Microsoft Docs[
^]
2) You could use a combination of the
System.Net.NetworkInformation Namespace | Microsoft Docs[
^] classes and WMI to fetch just the information you are interested in directly within your app:
Connecting to WMI Remotely with C# - Windows applications | Microsoft Docs[
^]
Since we have no idea what you are trying to do, or your skill level in C# we can;t help you much more at this stage.
Start reading the links above, work out what exactly you are trying to do with the information you can collect, and give it a try.