Dela via


Device.IsEmulator Method

Checks whether the device is an emulator or a physical device.

Namespace:  Microsoft.SmartDevice.Connectivity
Assembly:  Microsoft.SmartDevice.Connectivity (in Microsoft.SmartDevice.Connectivity.dll)

Syntax

'Declaration
Public Function IsEmulator As Boolean
'Usage
Dim instance As Device 
Dim returnValue As Boolean 

returnValue = instance.IsEmulator()
public bool IsEmulator()
public:
bool IsEmulator()
public function IsEmulator() : boolean

Return Value

Type: System.Boolean
True if device object refers to an emulator; otherwise, false.

Remarks

If the Datastore does not specify whether the device is an emulator, the method returns false and assumes the device is a physical device.

Examples

' Get the default device in the platform, usually an emulator. 
Dim device As Device = platform.GetDevice(platform.GetDefaultDeviceId())

' Output information about the device.
Console.WriteLine("Name:  " + device.Name + vbCr + vbLf + "Platform:  " & _
                  device.Platform.ToString() + vbCr + vbLf + "ID:  " + _
                  device.Id.ToString())

If device.IsEmulator() Then
    Console.WriteLine("Device is an Emulator")
End If 

' Output device properties
Console.WriteLine(vbCr + vbLf + "Device Properties:")
Console.WriteLine("    OS_Version: " + device.GetProperty("OS_Version"))
// Get the default device in the platform, usually an emulator.
Device device = platform.GetDevice(platform.GetDefaultDeviceId());

// Output information about the device.
Console.WriteLine("Name:  " + device.Name + "\r\n" +
                "Platform:  " + device.Platform + "\r\n" +
                "ID:  " + device.Id);

if (device.IsEmulator())
{
    Console.WriteLine("Device is an Emulator");
}

// Output device properties
Console.WriteLine("\r\nDevice Properties:");
Console.WriteLine("    OS_Version: " + device.GetProperty("OS_Version"));

.NET Framework Security

See Also

Reference

Device Class

Device Members

Microsoft.SmartDevice.Connectivity Namespace