答案 0 :(得分:0)
我终于找到了可行的答案,如下所示:
using Microsoft.Azure.Devices;
RegistryManager registryManager = RegistryManager.CreateFromConnectionString("registryreadconnectionstring");
Device device = await registryManager.GetDeviceAsync("device-id");
var count = device.CloudToDeviceMessageCount;
答案 1 :(得分:-1)
var device = new Microsoft.Azure.Devices.Device("device-id");
var cloudToDeviceMessageCount = device.CloudToDeviceMessageCount;