File Model

This will hold information on each file type

Lets create a struct in our Models namespace and name it FileModel.cs See: Struct vs Class

Fields

Now we will create five properties See: Variables vs Properties

Name
Type
Description

Extension

string

The file extension

Count

int

The number of files with the extension

Bytes

long

The total number of bytes

Characters

int

The total number of characters in each file

Encoding

System.Text.Encoding

The encoding type

See: Primitive Types

Example:

using System.Text;

namespace Library.Model;

public struct FileModel
{
    // The file extension
    public string Extension { get; set; }
    // The number of files with the extension
    public int Count { get; set; }
    // The total number of bytes
    public long Bytes { get; set; }
    // The total number of characters in each file
    public int Characters { get; set; }
    // The encoding type
    public Encoding Encoding { get; set; }
}

Last updated

Was this helpful?