how can we get ip address, subnet mask , default gateway and dns server by c# code?

dear all

please tell me how can we get ipaddress, subnet mask, default gateway and dns server by c# code?

i have got a code with:
ManagementClass objMC = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection objMOC = objMC.GetInstances();

string[] ipaddresses = (string[]) objMO["IPAddress"];
string[] subnets = (string[]) objMO["IPSubnet"];
string[] gateways = (string[]) objMO["DefaultIPGateway"];
string ipadr=ipaddresses[0].ToString();
string gate=gateways[0].ToString();
string snet=subnets[0].ToString();

but system.management namespace is working in windows 2000 operating system only ( am i right?) , it is giving error in XP.

please anybody give me the code .


thankzz in advanse
suneer