C# Get Active NIC IPv4 Address

I have multiple network cards on my computer. (Because of VMWare)

How can I find the IPv4 address of the active card. I mean if I send a ping in a terminal and intercept packet in WireShark, I want the address of "Source".

I thought of checking every network interface and look if GateWay is empty or null ? Or maybe ping and get the IP source of the ping request ? But cannot implement it.

For now I have this code which i found on StackOverFlow

 public static string GetLocalIpAddress()
            var host = Dns.GetHostEntry(Dns.GetHostName());
            return host.AddressList.First(h => h.AddressFamily == AddressFamily.InterNetwork).ToString();

But it gets me the IP of the VmWare card. But I don't know what else that ".First()" I could use.