What is the difference between File and FileInfo in C# ?

Posted by Lilitu88 on Stack Overflow See other posts from Stack Overflow or by Lilitu88
Published on 2009-08-24T21:06:59Z Indexed on 2010/04/13 2:53 UTC
Read the original article Hit count: 306

Filed under:
|
|

I've been reading that the static methods of the File Class are better used to perform small and few tasks on a file like checking to see if it exists and that we should use an instance of the FileInfo Class if we are going to perform many operations on a specific file.

I understand this and can simply use it that way blindly but I would like to know why is there a difference ? What is it about the way they work that make them suitable for different situations ? What is the point of having this 2 different classes that seem do the same in different ways ?

It would be helpful if someone could answer at least one of this questions.

© Stack Overflow or respective owner

Related posts about c#

Related posts about file