C#中关于System.Collections.Generic.IReadOnlyCollection< >数据类型的疑惑

写了一个语句:
BluetoothDeviceInfo[] devices = client.DiscoverDevices();
报错是:
无法将类型“System.Collections.Generic.IReadOnlyCollection<InTheHand.Net.Sockets.BluetoothDeviceInfo>”隐式转换为“InTheHand.Net.Sockets.BluetoothDeviceInfo[]”。存在一个显式转换(是否缺少强制转换?)
写成 BluetoothDeviceInfo[] devices = (BluetoothDeviceInfo[])client.DiscoverDevices() 来强制转换也不行。运行时还是报错,显示无法强转。

想知道System.Collections.Generic.IReadOnlyCollection< >这是一个什么类型的数据,我试了赋值给List< BluetoothDeviceInfo >也是类似报错。

调用LINQ的.ToArray()方法,将其转换成数组,示例如下:

IReadOnlyCollection<BluetoothDeviceInfo> list = new List<BluetoothDeviceInfo>
{
    new() {Id = 1},
    new() {Id = 2},
    new() {Id = 3},
    new() {Id = 4},
    new() {Id = 5}
}.AsReadOnly();

BluetoothDeviceInfo[] devices = list.ToArray();
foreach (var item in devices)
{
    Console.WriteLine(item.Id);
}

public class BluetoothDeviceInfo
{
    public int Id { get; set; }
}

IReadOnlyCollection的集合从字面理解,它是只读的,你不能修改IReadOnlyCollection集合中的数据,比如:添加,修改,删除集合中的元素等等。