Skip to content

Game.TaxResultType

Assembly:
Namespace: Game.Simulation

Type: enum

Base: System.Enum (underlying type: System.Int32)

Summary:
Represents the classification of a tax/finance entry as Income, Expense, or Any. The enum values map to integer signs (Income = 1, Expense = -1, Any = 0) which can be used for filtering, categorization, or deriving a sign for arithmetic operations in simulation and UI logic for Cities: Skylines 2 mods.


Fields

  • Income = 1
    Represents incoming money (positive). Commonly used to mark revenue items.

  • Expense = -1
    Represents outgoing money (negative). Used to mark costs or payouts.

  • Any = 0
    A neutral or wildcard value that can be used when filtering should match both income and expense (or when no specific sign is required). Note: numerically 0 — do not use directly as a multiplier expecting to preserve magnitude unless that is the intended effect.

Properties

  • None. Enums do not expose additional properties.

Constructors

  • Implicit default constructor (enum value) provided by the runtime. No explicit constructors.

Methods

  • None declared. Standard Enum methods (ToString, HasFlag, etc.) are available from System.Enum.

Usage Example

using Game.Simulation;

public class TaxProcessor
{
    // Example: filter entries by type (treat Any as a wildcard)
    public bool MatchesType(TaxEntry entry, TaxResultType filter)
    {
        return filter == TaxResultType.Any || entry.ResultType == filter;
    }

    // Example: get sign for arithmetic use
    public int GetSign(TaxResultType type)
    {
        return (int)type; // Income -> 1, Expense -> -1, Any -> 0
    }

    // Safer example: convert to sign but treat Any as positive (or choose appropriate behavior)
    public int GetSignDefaultingAnyToPositive(TaxResultType type)
    {
        return type == TaxResultType.Expense ? -1 : 1; // Any and Income -> 1
    }
}