Answer on Question # 43813, Programming, C#
Task: Which class of the .NET Framework should Hayley use to enable Sharon to view the file extension of the stock details file? Describe any four properties of the selected class.
Answer:
To do this Hayley should use "FileInfo" class from the "System.I0" namespace. It contains useful property "Extension" that returns string value with the file extension. To use this property Hayley must follow the next steps:
- Create an object of the "FileInfo" class:
System.I0.FileInfo object_name = new System. I0.FileInfo(string file_path);- Use "Extension" property: object_name. Extension that will return the extension of the file that was declared in the previous step.
Properties of "FileInfo" class: