Skip to content

Commit

Permalink
feat: Add LabelControlBaseExtensions -> FindByIdentifier
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkallesen committed Mar 21, 2024
1 parent bd991cf commit 2fc63a8
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,15 @@ public static class LabelControlBaseExtensions
public static bool IsValid(
this ILabelControlBase labelControl)
=> labelControl is not ILabelControl control || control.IsValid();

public static T? FindByIdentifier<T>(
this List<ILabelControlBase> labelControls,
string identifier)
where T : class, ILabelControlBase
{
ArgumentNullException.ThrowIfNull(labelControls);
ArgumentException.ThrowIfNullOrEmpty(identifier);

return labelControls.Find(x => x.Identifier == identifier) as T;
}
}

0 comments on commit 2fc63a8

Please sign in to comment.