You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
495 B
C#
24 lines
495 B
C#
namespace DS.Module.Core.Reflection;
|
|
|
|
/// <summary>
|
|
/// 抽象类
|
|
/// </summary>
|
|
public abstract class FinderBase<TItem> : IFinder<TItem>
|
|
{
|
|
private readonly object _syncObj = new object();
|
|
|
|
public TItem[] Find(Func<TItem, bool> predicate)
|
|
{
|
|
return this.FindAll().Where(predicate).ToArray();
|
|
}
|
|
|
|
public TItem[] FindAll()
|
|
{
|
|
lock (_syncObj)
|
|
{
|
|
return this.FindAllItems();
|
|
}
|
|
}
|
|
|
|
protected abstract TItem[] FindAllItems();
|
|
} |