/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit.Analyzers/Helpers/NodeTable.cs
27 строк
748 B
denys.kozhevnikov
Added initial roslyn analyzer to recommend use of PipeContext.CancellationToken for async methods.
07 фев 2023, 16:57
07 фев 2023, 16:57
e0722c4
Код
Авторство
О чём код?
namespace MassTransit.Analyzers.Helpers { using System.Collections.Concurrent; class NodeTable<T> { readonly ConcurrentDictionary<T, int> _nodes; int _count; public NodeTable(int capacity) { _nodes = new ConcurrentDictionary<T, int>(8, capacity); } /// <summary> /// Returns the index for the specified key, which can be any type that supports /// equality comparison /// </summary> /// <param name="key">The key to retrieve</param> /// <returns>The index that uniquely relates to the specified key</returns> public int this[T key] { get { return _nodes.GetOrAdd(key, k => ++_count); } } } }