C# 在Compact框架中删除只读
在Compact Framework中删除文件的只读属性的首选方法是什么,因为我们没有file::SetAttributes?您可以使用OpenNetCF,它有一个FileHelper类来实现该功能 或者,如果您不想走这条路,您可以使用本机方法进行PInvoke操作。这也适用于:C# 在Compact框架中删除只读,c#,compact-framework,C#,Compact Framework,在Compact Framework中删除文件的只读属性的首选方法是什么,因为我们没有file::SetAttributes?您可以使用OpenNetCF,它有一个FileHelper类来实现该功能 或者,如果您不想走这条路,您可以使用本机方法进行PInvoke操作。这也适用于: FileInfo fileInfo = new FileInfo(path); FileAttributes attributes = fileInfo.Attributes; if ((attributes &am
FileInfo fileInfo = new FileInfo(path);
FileAttributes attributes = fileInfo.Attributes;
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
// set the attributes to nonreadonly
fileInfo.Attributes &= ~FileAttributes.ReadOnly;
}