diff --git a/csharp/Platform.Data/ILinks.cs b/csharp/Platform.Data/ILinks.cs index 7438b68..f08a1d6 100644 --- a/csharp/Platform.Data/ILinks.cs +++ b/csharp/Platform.Data/ILinks.cs @@ -46,8 +46,21 @@ TConstants Constants /// /// Restriction on the contents of links.Ограничение на содержимое связей. /// The total number of links in the storage that meet the specified restriction.Общее число связей находящихся в хранилище, соответствующих указанному ограничению. + /// + /// This method is an optimization. It can be implemented using the Each method, but this default implementation may not be efficient enough for all use cases. + /// Этот метод является оптимизацией. Он может быть реализован с использованием метода Each, но эта реализация по умолчанию может быть недостаточно эффективной для всех случаев использования. + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - TLinkAddress Count(IList? restriction); + TLinkAddress Count(IList? restriction) + { + var counter = TLinkAddress.Zero; + Each(restriction, link => + { + counter++; + return Constants.Continue; + }); + return counter; + } /// /// Passes through all the links matching the pattern, invoking a handler for each matching link.