Click here to Skip to main content
15,901,035 members
Home / Discussions / C#
   

C#

 
GeneralRe: A MDI in a MDI Pin
sixefftee12-Mar-04 6:20
sixefftee12-Mar-04 6:20 
GeneralRe: A MDI in a MDI Pin
John Fisher12-Mar-04 7:53
John Fisher12-Mar-04 7:53 
GeneralRe: A MDI in a MDI Pin
sixefftee12-Mar-04 8:34
sixefftee12-Mar-04 8:34 
GeneralRe: A MDI in a MDI Pin
John Fisher12-Mar-04 11:26
John Fisher12-Mar-04 11:26 
QuestionCan you temporarily lock a directory? Pin
boozebomb112-Mar-04 2:42
boozebomb112-Mar-04 2:42 
AnswerRe: Can you temporarily lock a directory? Pin
Heath Stewart12-Mar-04 3:56
protectorHeath Stewart12-Mar-04 3:56 
GeneralRe: Can you temporarily lock a directory? Pin
boozebomb112-Mar-04 4:13
boozebomb112-Mar-04 4:13 
GeneralRe: Can you temporarily lock a directory? Pin
Heath Stewart12-Mar-04 4:23
protectorHeath Stewart12-Mar-04 4:23 
Yes there is, but no pure .NET way. Read NT Security Class for .NET[^], which of course only works on NT. Pay attention to the note toward the top of the page, too. There's a library written by Microsoft developers for NT security that you should use instead. That library will be included in .NET 2.0 in Q1 of 2005. Getting familiar with it now will help in the future if you upgrade your code base.

Still, though - what's the point? All you're doing is updating an XML document, so that's all that needs to be locked. Taking away permission and giving them back is dangerous if you don't account for every single exception. What if your code bombs and permissions are restored? It's not an effective solution.

If you need to update the XML document with a list of files in that directory and don't want that list to be modified while updating the XML document, the solution is simple: get a collection of filenames - which is a read-only collection of the files in that directory when you got the files. This can easily be achieved with the Directory.GetFiles static method, or the DirectoryInfo.GetFiles instance method. Update your XML document with those collections. That's an effective and proper solution.

 

Microsoft MVP, Visual C#
My Articles
GeneralCustom borders Pin
Mathew Hall12-Mar-04 2:24
Mathew Hall12-Mar-04 2:24 
GeneralRe: Custom borders Pin
John Fisher12-Mar-04 3:32
John Fisher12-Mar-04 3:32 
GeneralRe: Custom borders Pin
Mathew Hall13-Mar-04 2:09
Mathew Hall13-Mar-04 2:09 
GeneralRe: Custom borders Pin
John Fisher13-Mar-04 4:11
John Fisher13-Mar-04 4:11 
GeneralCatching a message Pin
T i T i12-Mar-04 1:06
T i T i12-Mar-04 1:06 
GeneralRe: Catching a message Pin
Mike Dimmick12-Mar-04 2:16
Mike Dimmick12-Mar-04 2:16 
GeneralRe: Catching a message Pin
Wraith212-Mar-04 2:27
Wraith212-Mar-04 2:27 
GeneralRe: Catching a message Pin
Heath Stewart12-Mar-04 3:41
protectorHeath Stewart12-Mar-04 3:41 
GeneralEventhandler + parallelport input Pin
NicklasRing11-Mar-04 23:01
NicklasRing11-Mar-04 23:01 
GeneralRe: Eventhandler + parallelport input Pin
John Fisher12-Mar-04 2:17
John Fisher12-Mar-04 2:17 
GeneralNeed Help with Transparency! Pin
Agent 8611-Mar-04 17:36
Agent 8611-Mar-04 17:36 
QuestionHow to know if there is a child control under a certain point ? Pin
Andres Coder11-Mar-04 17:06
Andres Coder11-Mar-04 17:06 
AnswerRe: How to know if there is a child control under a certain point ? Pin
OmegaSupreme12-Mar-04 2:06
OmegaSupreme12-Mar-04 2:06 
AnswerRe: How to know if there is a child control under a certain point ? Pin
John Fisher12-Mar-04 2:08
John Fisher12-Mar-04 2:08 
Generalc# opengl *.obj Pin
pertiu11-Mar-04 7:07
pertiu11-Mar-04 7:07 
GeneralRe: c# opengl *.obj Pin
Judah Gabriel Himango11-Mar-04 16:39
sponsorJudah Gabriel Himango11-Mar-04 16:39 
GeneralRe: c# opengl *.obj Pin
Heath Stewart12-Mar-04 3:32
protectorHeath Stewart12-Mar-04 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.