First you’ll add the System.Net namespace to your using section:

Example of code to get address from hostname:

This was tested in C# 2.0.