I am using Raspberry Pi2 with Windows 10 IoT Core OS, I am developing an UWP app in that I want to get Device Name of my Raspberry Pi 2. Can any one help me how to get it?
I tried using the following code but dont know is it correct way or not
public string GetDeviceName()
{
List<string> IpAddress = new List<string>();
var Hosts = Windows.Networking.Connectivity.NetworkInformation.GetHostNames().ToList();
foreach (var Host in Hosts)
{
string deviceName = Host.DisplayName;
return deviceName;
}
return null;
}