IsolatedStorageFileStream.Lock在SIlverlight4下工作吗?

时间:2010-04-16 23:32:20

标签: silverlight locking silverlight-4.0

Silverlight使用IsolatedStorageFileStream打开文件。

NET.4下的IsolatedStorageFileStream声称支持Lock Method(从FileStream继承)

以下代码

IsolatedStorageFile isf;
IsolatedStorageFileStream lockStream = new IsolatedStorageFileStream( "my.lck", FileMode.OpenOrCreate, isf );
lockStream.Lock( 0, 0 );

在VS2010和Silverlight 4

下生成以下错误,以便于阅读
'System.IO.IsolatedStorage.IsolatedStorageFileStream' does not contain a definition for 'Lock' 
and no extension method 'Lock' accepting a first argument of type 'System.IO.IsolatedStorage.IsolatedStorageFileStream' could be found 
(are you missing a using directive or an assembly reference?)   

1 个答案:

答案 0 :(得分:0)

LockUnlock实际上不受支持但存在,以便System.IO.FileStream类在框架之间保持一致,并允许将来实现该功能。