/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Serialization/DeserializeVariableExtensions.cs
48 строк
2 KB
Chris Patterson
Integration of all external packages into MassTransit, split out into Abstractions, Middleware, and the core MassTransit assembly.
22 янв 2022, 18:24
22 янв 2022, 18:24
b5b4f50
Код
Авторство
О чём код?
namespace MassTransit.Serialization { using System.Collections.Generic; public static class DeserializeVariableExtensions { /// <summary> /// Return an object from the dictionary converted to T using the message deserializer /// </summary> /// <param name="dictionary"></param> /// <param name="key"></param> /// <param name="value"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static bool TryGetValue<T>(this IDictionary<string, object> dictionary, string key, out T value) where T : class { if (dictionary is null) { value = null; return false; } return SystemTextJsonMessageSerializer.Instance.TryGetValue(dictionary, key, out value); } /// <summary> /// Return an object from the dictionary converted to T using the message deserializer /// </summary> /// <param name="dictionary"></param> /// <param name="key"></param> /// <param name="value"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static bool TryGetValue<T>(this IDictionary<string, object> dictionary, string key, out T? value) where T : struct { if (dictionary is null) { value = null; return false; } return SystemTextJsonMessageSerializer.Instance.TryGetValue(dictionary, key, out value); } } }