在文件Stream,我有时使用文件。 删除“分配”特征,如名称所示,在我称之为“处置”方法时,自动删除档案。 如果我在申请期间作出其他决定,我想再次拆除旗帜并保存档案?
由于这是最初的WindowsAPI的特征,我在那里看到,但我无法找到解决办法。
如果有可能,你是否知道如何重新打造国旗?
Thanks Martin
在文件Stream,我有时使用文件。 删除“分配”特征,如名称所示,在我称之为“处置”方法时,自动删除档案。 如果我在申请期间作出其他决定,我想再次拆除旗帜并保存档案?
由于这是最初的WindowsAPI的特征,我在那里看到,但我无法找到解决办法。
如果有可能,你是否知道如何重新打造国旗?
Thanks Martin
我将使用
在你创建档案后,不可能更改国旗。 你只能改变档案属性。 我也观看了Windows API,只有暴露的方法是SetFileAttributes
,使你只能改变属性。
You should think of different logic to accomplish this, like implement System.IO.File.Delete()
by your own when you want file to be deleted and don t relay to FILE_FLAG_DELETE_ON_CLOSE
.
样本:
public class FileStreamEx : System.IO.FileStream
{
private bool _deleteOnDispose = false;
public FileStreamEx(string path, ....) : base(path, ...) { }
public bool DeleteOnDispose
{
get { return _deleteOnDispose; }
set { _deleteOnDispose = value; }
}
protected override void Dispose(bool disposing)
{
if (_deleteOnDispose)
{
System.IO.File.Delete(this.Name);
}
base.Dispose(disposing);
}
}
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...