无法将类型'Robotics.Mobile.Core.Bluetooth.LE.IDevice隐式转换为int'

时间:2015-10-13 15:23:40

标签: c# xamarin bluetooth

我正在使用monkey.robotics插件处理xamarin.forms应用。在我的应用程序中,我想将属性IDevice显示为字符串或int。

我目前有以下一行:

var data = new entry{ Longitude = await GetLongitude(), Latitude = await GetLatitude(), Percentage = bpm, Device = e.Device,  };

但它会抛出Cannot implicitly convert type 'Robotics.Mobile.Core.Bluetooth.LE.IDevice to int'错误消息。我理解这一点,但不知道解决方法。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

IDevice是一个界面。您无法将其转换为int或字符串。任何实现IDevice的类都将具有可以显示的名称(字符串)或ID(GUID)等属性。