ASK Question

Quick links:
Latest articles
Internship
Members

Languages:
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL

Web:
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.

Programs:
C
C++
DS
Java
C#
Python


Aptitude:
C
C++
Java
DBMS

Interview:
C
Embedded C
Java
SEO
HR

CS Subjects:
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS

More:
Articles
Puzzles
News/Updates


Home » .Net » C# programs

C# file handling (File class) solved programs/examples



This section contains programs on ‘File’ class (file handling) in C# programming language with output and explanation. This section contains all examples on all methods of ‘File’ class.

List of all C# file handling ('File' class) programs

  1. C# program to read byte buffer from a file.
    In this C# program, we are going to learn how to read all bytes (byte buffer) from a file? To read all bytes, we are using ReadAllBytes() method of File class.
  2. C# program to write byte buffer into a file.
    In this C# program, we are going to learn how to write byte buffer in a text file? To write byte buffer, we are using WriteAllBytes() method of File class.
  3. C# program to write multiple (all) lines into a text file.
    In this C# program, we are going learn how to write all lines into a text file? To write, we are using WriteAllLines() method of File class.
  4. C# program to read all lines of a text file.
    In this C# program, we are going to learn how to read all lines of a text file? To read all lines, we use ReadAllLines() method of File class.
  5. C# program to move file from one location to another location.
    In this C# program, we are going to learn how to move a file from one location to another location? To implement this, we are using ‘Move()’ method ‘File’ class.
  6. C# program to set last write time of file or directory in UTC format.
    In this C# program, we are going to learn how to set last write time in UTC format using C# program? To set this, we are using ‘SetLastWriteTimeUtc()’ of ‘File’ class.
  7. C# program to get last write time in UTC format of file or directory.
    In this C# program, we are going to learn how to get last write time in UTC format of a file or a directory? To get this, we are using ‘GetLastWriteTimeUtc()’ method of ‘File’ class.
  8. C# program to set last write time of file or directory.
    In this C# program, we are going to learn how to set last write time of a file or a directory? To set this, we are using ‘SetLastWriteTime()’ of ‘File’ class.
  9. C# program to get last write time of file or directory.
    In this C# program, we are going to learn how to get last write time of a file or a directory? To get this, we are using ‘GetLastWriteTime()’ method of ‘File’ class.
  10. C# program to set last access time in UTC format of file or directory.
    In this C# program, we are going to learn how to set (define) last access time in UTC format of a file or directory? To define the last access time, we are using ‘SetLastAccessTimeUtc()’ method of ‘File’ class.
  11. C# program to get last access time of file or directory in UTC format.
    In this C# program, we are going to learn how to get last access time of file or directory in UTC format? To get last access time in UTC, we are using ‘GetLastAccessTimeUtc()’ method of ‘File’ class.
  12. C# program to set last access time of file or directory.
    In this C# program, we are going to learn how to set (define) last access time of a file or directory? To define the last access time, we are using ‘SetLastAccessTime()’ method of ‘File’ class.
  13. C# program to get last access time of file or directory.
    In this C# program, we are going to learn how to get and print the last access time of a file or directory? Here, we have a method GetLastAccessTime() of ‘File’ class.
  14. C# program to copy content of one file to another file by overwriting same file name.
    In this C# program, we are going to learn how to copy the content of one file to another file by overwriting the file, if file has the same name.
  15. C# program to copy content of one file to another file.
    In this C# program, we are going to learn how to copy content of one file to another file? To implement this program we are using File.Copy() method.
  16. C# program to set attributes of specified file.
    In this C# program, we are going to learn how to set file’s attributes? Here, we are using File.SetAttributes() method to define new file attributes.
  17. C# program to get attributes of a specified file.
    In this C# program, we are going to learn how to get attributes of a file? Here, method File.GetAttributes() is using.
  18. C# program to set new file creation time.
    In this C# program, we are going to learn how to set (define) a new file creation time? Here, method File.SetCreationTime() is using to define a new time of file creation.
  19. C# program to get file creation time.
    In this C# program, we are going to learn how to print (get) the file creation time? Here, method File.GetCreationTime() is using.
  20. C# program to delete a text file.
    In this C# program, we are going to learn how to delete a text file? Method File.Delete() is using to delete the file.
  21. C# program to replace content of one file from other file and create backup file.
    In this C# program, we will learn how to replace text of a file with the text of another file and also create a backup file?
  22. C# program to read text from a file and append in another file.
    In this C# program, we are going to read text from a file and append it to another file, to append text we will use File.AppendAllText() method.
  23. C# program to read text from a file.
    In this C# program, we are going to learn how to read text from a file? Here, we are using Method ReadAllText() of “File” class to read text from a file.
  24. C# program to write text to a file.
    In this C# program, we are going to learn how to write text in a file? Here, we are using Method WriteAllText() of "File" class to write text in a file.




Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.