Click here to Skip to main content
15,917,176 members
Home / Discussions / C#
   

C#

 
GeneralRe: _ID field goes wrong Pin
misCafe22-May-09 16:43
misCafe22-May-09 16:43 
GeneralRe: _ID field goes wrong Pin
fly90422-May-09 17:10
fly90422-May-09 17:10 
GeneralRe: _ID field goes wrong Pin
Luc Pattyn22-May-09 17:18
sitebuilderLuc Pattyn22-May-09 17:18 
GeneralRe: _ID field goes wrong Pin
Luc Pattyn22-May-09 17:19
sitebuilderLuc Pattyn22-May-09 17:19 
AnswerRe: _ID field goes wrong Pin
fly90422-May-09 16:34
fly90422-May-09 16:34 
GeneralRe: _ID field goes wrong Pin
misCafe22-May-09 17:27
misCafe22-May-09 17:27 
Questionwindows installer user interface checkbox to disable next button Pin
Member 202095122-May-09 11:07
Member 202095122-May-09 11:07 
QuestionChange FileAccess/FileShare permissions on a FileStream Pin
Dan Neely22-May-09 10:18
Dan Neely22-May-09 10:18 
Is there anyway to do this without closing/reopening the file?

I found this in some code I wrote a few years, and after cringing and hitting google, failed to do so.

m_fsXMLLib = new FileStream(m_fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
// stuff that writes to the file



//there doesn't appear to be any way to change FileAccess values while the stream is open,
//and the risk of a steal occuring here is much lower than a read attempt in midwrite.
m_fsXMLLib.Close();
m_fsXMLLib = new FileStream(m_fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);


My intent is to keep anyone from trying to read the file while it's being written and in an inconsistent state. After saving the file, I want it kept open to prevent anyone else from being able to modify it while letting them have read only rights.

It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies

AnswerRe: Change FileAccess/FileShare permissions on a FileStream Pin
Luc Pattyn22-May-09 11:21
sitebuilderLuc Pattyn22-May-09 11:21 
GeneralRe: Change FileAccess/FileShare permissions on a FileStream Pin
Dan Neely22-May-09 15:52
Dan Neely22-May-09 15:52 
QuestionHow to get the roles for a user other than the current one Pin
MGoetz22-May-09 8:22
MGoetz22-May-09 8:22 
AnswerRe: How to get the roles for a user other than the current one Pin
0x3c022-May-09 8:48
0x3c022-May-09 8:48 
GeneralRe: How to get the roles for a user other than the current one Pin
MGoetz22-May-09 9:13
MGoetz22-May-09 9:13 
GeneralRe: How to get the roles for a user other than the current one Pin
MGoetz26-May-09 4:44
MGoetz26-May-09 4:44 
Questionexternal database? Pin
benjamin yap22-May-09 6:55
benjamin yap22-May-09 6:55 
AnswerRe: external database? Pin
EliottA22-May-09 7:06
EliottA22-May-09 7:06 
GeneralRe: external database? Pin
benjamin yap22-May-09 7:09
benjamin yap22-May-09 7:09 
GeneralRe: external database? Pin
EliottA22-May-09 7:14
EliottA22-May-09 7:14 
GeneralRe: external database? Pin
benjamin yap22-May-09 7:21
benjamin yap22-May-09 7:21 
GeneralRe: external database? Pin
EliottA22-May-09 7:27
EliottA22-May-09 7:27 
GeneralRe: external database? Pin
ameeen22-May-09 8:52
ameeen22-May-09 8:52 
GeneralRe: external database? Pin
EliottA22-May-09 9:36
EliottA22-May-09 9:36 
AnswerRe: external database? Pin
Ennis Ray Lynch, Jr.22-May-09 7:59
Ennis Ray Lynch, Jr.22-May-09 7:59 
QuestionByteA Column in PostGreSQL Pin
xcorporation22-May-09 6:49
xcorporation22-May-09 6:49 
Questionhow to create function in c# ? Pin
xingselex22-May-09 5:55
xingselex22-May-09 5:55 

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.