Skip to content

Commit

Permalink
Make parameterless CTOR of CalDateTime private (ical-org#719)
Browse files Browse the repository at this point in the history
* Make parameterless CTOR of CalDateTime internal

Reasoning: Should not be part of the public API

* fix typo in error msg

* Make CalDateTime CTOR private
  • Loading branch information
axunonb authored Feb 10, 2025
1 parent ce9a30b commit 7dfd8a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Ical.Net/DataTypes/CalDateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public sealed class CalDateTime : IComparable<CalDateTime>, IFormattable
/// <summary>
/// This constructor is required for the SerializerFactory to work.
/// </summary>
public CalDateTime() { }
private CalDateTime()
{
// required for the SerializerFactory to work
}

/// <summary>
/// Creates a new instance of the <see cref="CalDateTime"/> class.
Expand Down Expand Up @@ -94,7 +97,7 @@ public CalDateTime(DateTime value, bool hasTime = true) : this(
{
DateTimeKind.Utc => UtcTzId,
DateTimeKind.Unspecified => null,
_ => throw new ArgumentException($"An instance of {nameof(CalDateTime)} can only be initializd from a {nameof(DateTime)} of kind {nameof(DateTimeKind.Utc)} or {nameof(DateTimeKind.Unspecified)}.")
_ => throw new ArgumentException($"An instance of {nameof(CalDateTime)} can only be initialized from a {nameof(DateTime)} of kind {nameof(DateTimeKind.Utc)} or {nameof(DateTimeKind.Unspecified)}.")
},
hasTime)
{ }
Expand Down

0 comments on commit 7dfd8a5

Please sign in to comment.