I guess you're talking about getting the top-level domain name from the host name? The TLD is just the last two dot-separated parts of the full host name, so a function would look like this:
public static string GetTopLevelDomain(string hostName)
{
int lastDot = hostName.LastIndexOf('.');
if (lastDot < 0)
return hostName;
int previousDot = hostName.LastIndexOf('.', lastDot - 1);
return (previousDot >= 0) ? hostName.Substring(previousDot + 1) : hostName;
}
If you're actually trying to figure out who owns the domain, you have to use a whois lookup. Here's a whois example in C#. The information just comes back as plain text; keep in mind that it won't necessarily even tell you the real person or company who owns it, sometimes that information is private and all you'll get is the registrar (like GoDaddy).
Also, different whois servers will give different information and different areas; for example you can get information on a U.S. domain with ARIN, but for European domains you need to use RIPE instead. Honestly I hope that this isn't what you're trying to do because you're going to find that it's a quite a tar-pit; there's no simple way of reliably determining that Domain X is owned by Company Y.