C# Program to Check the Information of the File

This is a C# Program to view the information of the file.

Problem Description

This C# Program Views the Information of the File.

Problem Solution

Here the Attributes property that is used returns an enumerated constant that is encoded as enum flags.

Program/Source Code

Here is source code of the C# Program to View the Information of the File. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

/*
 * C# Program to View the Information of the File
 */
using System;
using System.IO;
class Program
{
    static void Main()
    {
        FileInfo info = new FileInfo("C:\\sri\\srip.txt");
        FileAttributes attributes = info.Attributes;
        Console.WriteLine("Nature(Attribute) of the File : {0}",attributes);
        Console.Read();
    }
}
Program Explanation

This C# program is used to view the information of the file. Here the Attributes property is used to return an enumerated constant that is encoded as enum flags. Print the information of the file.

advertisement
advertisement
Runtime Test Cases
 
Nature(Attribute) of the File : Archive

Sanfoundry Global Education & Learning Series – 1000 C# Programs.

If you wish to look at all C# Programming examples, go to 1000 C# Programs.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.