Skip to content

Commit

Permalink
Update comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Mar 12, 2024
1 parent 95099e9 commit 8e7936b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 10 additions & 7 deletions src/Qowaiv/Collections/EmailAddressCollection.IReadOnlySet.cs
Expand Up @@ -43,23 +43,26 @@ public EmailAddressCollection Append(EmailAddress item)
else return this;
}

/// <inheritdoc />
/// <summary>Determines if the set contains a specific email address.</summary>
/// <param name="item">
/// The email address to check if the set contains.
/// </param>
[Pure]
public bool Contains(EmailAddress item)
=> item.HasValue
&& Array.BinarySearch(val, item) >= 0;

/// <inheritdoc />
/// <inheritdoc cref="ISet{T}.IsSubsetOf(IEnumerable{T})"/>
[Pure]
public bool IsSubsetOf(IEnumerable<EmailAddress> other)
=> Count == 0 || m_Value!.ToHashSet().IsSubsetOf(other);

/// <inheritdoc />
/// <inheritdoc cref="ISet{T}.IsProperSubsetOf(IEnumerable{T})"/>
[Pure]
public bool IsProperSubsetOf(IEnumerable<EmailAddress> other)
=> val.ToHashSet().IsProperSubsetOf(other);

/// <inheritdoc />
/// <inheritdoc cref="ISet{T}.IsSupersetOf(IEnumerable{T})"/>
[Pure]
public bool IsSupersetOf(IEnumerable<EmailAddress> other)
{
Expand All @@ -70,20 +73,20 @@ public bool IsSupersetOf(IEnumerable<EmailAddress> other)
return true;
}

/// <inheritdoc />
/// <inheritdoc cref="ISet{T}.IsProperSupersetOf(IEnumerable{T})"/>
[Pure]
public bool IsProperSupersetOf(IEnumerable<EmailAddress> other)
=> Count != 0 && m_Value!.ToHashSet().IsProperSupersetOf(other);

/// <inheritdoc />
/// <inheritdoc cref="ISet{T}.Overlaps(IEnumerable{T})"/>
[Pure]
public bool Overlaps(IEnumerable<EmailAddress> other)
{
if (Count == 0) return false;
return Guard.NotNull(other).Any(Contains);
}

/// <inheritdoc />
/// <inheritdoc cref="ISet{T}.SetEquals(IEnumerable{T})"/>
[Pure]
public bool SetEquals(IEnumerable<EmailAddress> other)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Qowaiv/Collections/EmailAddressCollection.cs
Expand Up @@ -7,9 +7,6 @@ namespace Qowaiv.Collections;
[SingleValueObject(SingleValueStaticOptions.All, typeof(string))]
[OpenApiDataType(description: "Comma separated list of email addresses defined by RFC 5322.", example: "info@qowaiv.org,test@test.com", type: "string", format: "email-collection", nullable: true)]
[TypeConverter(typeof(Conversion.Collections.EmailAddressCollectionTypeConverter))]
//#if NET6_0_OR_GREATER
//[System.Text.Json.Serialization.JsonConverter(typeof(Json.EmailAddressJsonConverter))]
//#endif
public readonly partial struct EmailAddressCollection : IXmlSerializable, IFormattable, IEquatable<EmailAddressCollection>, IEmpty<EmailAddressCollection>
{
/// <summary>Represents an empty email address collection.</summary>
Expand Down Expand Up @@ -155,7 +152,7 @@ public string ToString(string? format, IFormatProvider? formatProvider)
public static bool TryParse(string? s, IFormatProvider? formatProvider, out EmailAddressCollection result)
{
result = default;
if (!string.IsNullOrEmpty(s))
if (s is { Length: > 0 })
{
var addresses = new List<EmailAddress>();
var strs = s.Split(Separators, StringSplitOptions.RemoveEmptyEntries).Select(str => str.Trim());
Expand Down

0 comments on commit 8e7936b

Please sign in to comment.