ex-int-02-meet-the-teacher/MeetTheTeacher/Model/TimeFrame.cs
github-classroom[bot] 1be1863b20
Initial commit
2025-04-24 07:02:41 +00:00

38 lines
1.2 KiB
C#

using System.Globalization;
namespace MeetTheTeacher.Model;
/// <summary>
/// Represents a time frame between a start and end time.
/// Start time is always before end time.
/// </summary>
/// <param name="Start">Start time</param>
/// <param name="End">End time</param>
public readonly record struct TimeFrame(TimeOnly Start, TimeOnly End)
{
private static readonly CultureInfo culture = new ("de-AT");
/// <summary>
/// Tries to parse a time frame from a string in format HH:MM-HH:MM.
/// Additional whitespace is trimmed and ignored.
/// </summary>
/// <param name="timeFrame">Timeframe string to parse</param>
/// <param name="result">Set to the parsed time frame if possible</param>
/// <returns>True if time frame could be parsed successfully; false otherwise</returns>
public static bool TryParse(string timeFrame, out TimeFrame? result)
{
// TODO
result = null;
return false;
}
/// <summary>
/// Returns a string representation of the time frame in format HH:MM-HH:MM
/// </summary>
/// <returns></returns>
public override string ToString()
{
// TODO
return null!;
}
}