

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Program to get information about a file
To get information about a file means to get what all attributes are set for that particular file. For example, a file can be normal, hidden, archived, etc.
Firstly, use the FileInfo class −
FileInfo info = new FileInfo("hello.txt");
Now, use FileAttributes to get information about a file −
FileAttributes attr = info.Attributes;
The following is the code −
Example
using System.IO; using System; public class Program { public static void Main() { using (StreamWriter sw = new StreamWriter("hello.txt")) { sw.WriteLine("This is demo text!"); } FileInfo info = new FileInfo("hello.txt"); FileAttributes attr = info.Attributes; Console.WriteLine(attr); } }
Output
Normal
- Related Questions & Answers
- How to get a file system information using Python?
- How to get a snapshot of information about Process API in Java 9?
- How to get information about USB mounted or not in android?
- Program to get JTextArea font information
- How to get information about mobile supports data and voice in android?
- How to get information about mobile supports sms or not in android?
- How to get information about network roaming is enabled or not in android?
- How to get information about mobile supports in whole world or not in android?
- How to retrieve specific file(s) information using Get-ChildItem in PowerShell?
- Get the information about the memory layout of the masked array in Numpy
- How can I get the information about a particular column of a table by MySQL DESCRIBE statement?
- Include information about the document in HTML
- Getting Information About MySQL Databases and Tables
- How to get the system configuration information relevant to an open file using Python?
- Java Program to remove file information from a filename returning only its path component
Advertisements