LFInteractive Docs
  • Programming Documentation
  • C#
    • Installing Visual Studio
    • Understanding C#
      • Namespaces
      • Classes
      • Enum
      • Variables
        • Static Types
        • Primitive Types
        • Access Modifiers
        • Variables vs Properties
        • Nullable Variables
      • Getters and Setters
      • Solution vs Project
      • Struct vs Class
      • Coding Conventions
      • Tasks and Async
        • Parallel Tasks
      • Methods
      • PreProcessor Statements
    • Creating Your First Console App
      • Class Library
        • Models
          • File Model
          • Result Model
        • Controllers
          • File Controller
          • File System Controller
      • Console App
        • Nuget Packages
        • Main Method
    • Minecraft.NET
      • Minecraft.NET Library
      • Modrinth.NET Library
      • CurseForge.NET Library
      • Fabric.NET Library
    • Common Lib
      • Strings
      • Advanced Network Client
      • Advanced Timer
      • Advanced File Info
      • Configuration File
      • Application Config
      • Database File
      • Crypt Class
  • C++
    • Networking
      • Windows Socket (Client)
    • cclip
    • VCPKG
    • spdlog
      • Getting Started
      • Patterns
Powered by GitBook
On this page
  • Fields
  • Example:
  • ToString

Was this helpful?

Edit on GitHub
  1. C#
  2. Creating Your First Console App
  3. Class Library
  4. Models

Result Model

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

Fields

Now we will create four properties See: Variables vs Properties

Name
Type
Description

Count

int

The number of results

NumberOfFiles

int

The total number of files processed

Duration

TimeSpan

The time it took to compile results

Items

FileModel[]

The file extensions processed

See: Primitive Types

Example:

namespace Library.Model;

public struct ResultModel
{
    // The number of results
    public int Count { get; set; }

    // The total number of files processed
    public int NumberOfFiles { get; set; }

    // The time it took to compile results
    public TimeSpan Duration { get; set; }

    // The file extensions processed
    public FileModel[] Items { get; set; }
}

ToString

Add ToString() Method

public override string ToString()
{
    return JsonConvert.SerializeObject(this, Formatting.Indented);
}
PreviousFile ModelNextControllers

Last updated 1 year ago

Was this helpful?