Click here to Skip to main content
15,896,154 members
Home / Discussions / C#
   

C#

 
QuestionSort / Find on BindingList Pin
Chris Losinger10-Mar-06 8:47
professionalChris Losinger10-Mar-06 8:47 
AnswerRe: Sort / Find on BindingList Pin
Nicholas Butler11-Mar-06 1:49
sitebuilderNicholas Butler11-Mar-06 1:49 
GeneralRe: Sort / Find on BindingList Pin
Chris Losinger13-Mar-06 4:21
professionalChris Losinger13-Mar-06 4:21 
AnswerRe: Sort / Find on BindingList Pin
Nicholas Butler13-Mar-06 4:59
sitebuilderNicholas Butler13-Mar-06 4:59 
GeneralRe: Sort / Find on BindingList Pin
Chris Losinger13-Mar-06 7:26
professionalChris Losinger13-Mar-06 7:26 
QuestionBuilding DotnetNuke module Using C# 2.0 Pin
Chandana Subasinghe10-Mar-06 7:37
Chandana Subasinghe10-Mar-06 7:37 
AnswerRe: Building DotnetNuke module Using C# 2.0 Pin
Colin Angus Mackay10-Mar-06 12:51
Colin Angus Mackay10-Mar-06 12:51 
QuestionFileInfo.Exists returns False even if the file exists Pin
chopinrlz10-Mar-06 6:23
chopinrlz10-Mar-06 6:23 
Hello,

I have a question about the FileInfo object: I'm wondering if anyone eles has experienced this issue.

I'm currently working with Visual Studio 2005 and the .NET Framework 2.0. I just finished debugging a small portion of my code and I noticed the following issue. The FileInfo.Exists property was returning false even when the file did exist on the file system. Here's how I got this to occur:


using System;
using System.IO;

namespace TestCode {
static void Main(string[] args) {

// Construct the FileInfo object
FileInfo someNewFile = new FileInfo( @"C:\myNewFile.txt" );

// Create a new file after creating a FileInfo object
FileStream fs = new FileStream( @"C:\myNewFile.txt", FileMode.Create, FileAccess.ReadWrite,
FileShare.None );

// Create some erroneous data and write it to the file
byte[] bytes = new byte[1] { '\0' };
fs.Write( bytes, 0, 1 );

// Flush and Close the FileStream
fs.Flush();
fs.Close();

// --------- ERROR --------------
// Note the following error: someNewFile.Exists returns FALSE
bool exists = someNewFile.Exists;
Console.WriteLine( "someNewFile.Exists returned " + exists );
}
}


So as you can see, I created the file after instantiating the FileInfo object. I checked the MSDN Documentation for Visual Studio 2005 and did not find any mention of this behavior, so... I'm wondering:

1. Has anyone else experienced this issue?
2. Can this be recreated on someone else's computer with the above code?
3. Is this intentional and simply not documented anywhere?

Thanks!
-Christian
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
Dan Neely10-Mar-06 6:53
Dan Neely10-Mar-06 6:53 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
Stefan Troschuetz10-Mar-06 6:55
Stefan Troschuetz10-Mar-06 6:55 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
Guffa10-Mar-06 7:10
Guffa10-Mar-06 7:10 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
FocusedWolf10-Mar-06 8:42
FocusedWolf10-Mar-06 8:42 
QuestionImage with transparent background Pin
stu8310-Mar-06 5:33
stu8310-Mar-06 5:33 
QuestionImage with transparent background Pin
stu8310-Mar-06 5:24
stu8310-Mar-06 5:24 
QuestionControl visible changed event Pin
malharone10-Mar-06 4:28
malharone10-Mar-06 4:28 
AnswerRe: Control visible changed event Pin
Office Lineman10-Mar-06 6:10
Office Lineman10-Mar-06 6:10 
GeneralRe: Control visible changed event Pin
malharone10-Mar-06 7:36
malharone10-Mar-06 7:36 
GeneralRe: Control visible changed event Pin
Office Lineman10-Mar-06 7:56
Office Lineman10-Mar-06 7:56 
GeneralRe: Control visible changed event Pin
malharone10-Mar-06 8:07
malharone10-Mar-06 8:07 
GeneralRe: Control visible changed event Pin
Office Lineman10-Mar-06 8:43
Office Lineman10-Mar-06 8:43 
GeneralRe: Control visible changed event Pin
godvicien13-Oct-10 20:53
godvicien13-Oct-10 20:53 
QuestionGrid Veiw Pin
papa198010-Mar-06 4:19
papa198010-Mar-06 4:19 
AnswerRe: Grid Veiw Pin
ToddHileHoffer10-Mar-06 8:12
ToddHileHoffer10-Mar-06 8:12 
GeneralRe: Grid Veiw Pin
papa198011-Mar-06 22:39
papa198011-Mar-06 22:39 
QuestionDynamic Menu Pin
vatzcar10-Mar-06 3:56
vatzcar10-Mar-06 3:56 

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.