Skip to content

Commit 5ad4310

Browse files
committed
feat: Add LabelControlBaseExtensions -> FindByIdentifier
1 parent 73d517d commit 5ad4310

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Atc.Wpf.Controls/LabelControls/Extensions/LabelControlBaseExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,15 @@ public static class LabelControlBaseExtensions
66
public static bool IsValid(
77
this ILabelControlBase labelControl)
88
=> labelControl is not ILabelControl control || control.IsValid();
9+
10+
public static T? FindByIdentifier<T>(
11+
this List<ILabelControlBase> labelControls,
12+
string identifier)
13+
where T : class, ILabelControlBase
14+
{
15+
ArgumentNullException.ThrowIfNull(labelControls);
16+
ArgumentException.ThrowIfNullOrEmpty(identifier);
17+
18+
return labelControls.Find(x => x.Identifier == identifier) as T;
19+
}
920
}

0 commit comments

Comments
 (0)