隐式转换为"System.IDisposable"错误 [英] Implicitly convertible to 'System.IDisposable' error
本文介绍了隐式转换为"System.IDisposable"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是我想要做的:
private KinectAudioSource CreateAudioSource()
{
var source = KinectSensor.KinectSensors[0].AudioSource;
source.NoiseSuppression = _isNoiseSuppressionOn;
source.AutomaticGainControlEnabled = _isAutomaticGainOn;
return source;
}
private object lockObj = new object();
private void RecordKinectAudio()
{
lock (lockObj)
{
using (var source = CreateAudioSource())
{
}
}
}
"using"语句给出一个错误,指出:
The 'using' statement gives one error which states:
using语句中使用的'Microsoft.Kinect.KinectAudioSource':type必须隐式转换为'System.IDisposable'
'Microsoft.Kinect.KinectAudioSource':type used in a using statement must be implicitly convertible to 'System.IDisposable'
如何消除此错误,这是什么意思?
How do I eliminate this error and what does it mean?
推荐答案
我参加聚会很晚,但是我应该说:
I am very late to the party, but I should say:
如果在using语句中使用上下文时遇到此错误,则必须添加reference to Entity Framework
.
You must add a reference to Entity Framework
if you get this error while using context inside using statement.
这篇关于隐式转换为"System.IDisposable"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文