Files
basic-computer-games/83_Stock_Market/csharp/TradingDay.cs
2022-01-17 11:56:20 +02:00

25 lines
653 B
C#

using System.Collections.Immutable;
using System.Linq;
namespace Game
{
/// <summary>
/// Represents a single trading day.
/// </summary>
public record TradingDay
{
/// <summary>
/// Gets the average share price of all companies in the market this
/// day.
/// </summary>
public double AverageSharePrice =>
Companies.Average (company => company.SharePrice);
/// <summary>
/// Gets the collection of public listed companies in the stock market
/// this day.
/// </summary>
public ImmutableArray<Company> Companies { get; init; }
}
}