Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用多个库定义定义类型C#_C# - Fatal编程技术网

使用多个库定义定义类型C#

使用多个库定义定义类型C#,c#,C#,我有一个新的功能,我正试图添加到现有的(工作)程序。这个新功能需要一个库参考,其中包括我已经在使用的类型设备的定义。。。 原代码为: Device.BeginInvokeOnMainThread(() => { devices.Add (e.Device); }); 为了指定我打算引用的定义,我将其更改为: Robotics.Mobile.Core.Bluetooth.LE.Device.BeginInvokeOnMainThread ( () =>

我有一个新的功能,我正试图添加到现有的(工作)程序。这个新功能需要一个库参考,其中包括我已经在使用的类型
设备的定义。。。
原代码为:

Device.BeginInvokeOnMainThread(() => {
                devices.Add (e.Device);
});
为了指定我打算引用的定义,我将其更改为:

Robotics.Mobile.Core.Bluetooth.LE.Device.BeginInvokeOnMainThread ( () => {
                devices.Add (e.Device);
);
但是,现在会抛出错误:

Robotics.Mobile.Core.Bluetooth.LE.Device不包含“BeginInvokeMainThread”的定义


我如何解决这个问题?

试着去定义
Robotics.Mobile.Core.Bluetooth.LE.Device
类(按F12键),是否有方法
BeginInvokeOnMainThread
?@tchelidze Nope,是Xamarin框架中的核心命令。我想要的东西在功能上与Xamarin中没有经验的顶级代码片段相同,但正如我所看到的,
BeginInvokeOnMainThread
方法在
Xamarin.Forms.Device
类中声明。@tchelidze是的,那么我如何引用它呢,在不使设备模棱两可的情况下,请尝试以下操作
Xamarin.Forms.Device.BeginInvokeOnMainThread(()=>{devices.Add(e.Device);})