mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
Fix.
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
* [Server] Added interceptor for unsubscriptions.
|
* [Server] Added interceptor for unsubscriptions.
|
||||||
* [MQTTnet.Server] Added interceptor for unsubscriptions.
|
* [MQTTnet.Server] Added interceptor for unsubscriptions.
|
||||||
* [MQTTnet.AspNetCore] improved compatibility with AspNetCore 3.1
|
* [MQTTnet.AspNetCore] improved compatibility with AspNetCore 3.1
|
||||||
* [MqttApplicationMessage] Added GetUserProperty<T> convenience method (thanks to @PMExtra).
|
* [Core] Added MqttApplicationMessage.GetUserProperty<T>() convenience method (thanks to @PMExtra).
|
||||||
</releaseNotes>
|
</releaseNotes>
|
||||||
<copyright>Copyright Christian Kratky 2016-2019</copyright>
|
<copyright>Copyright Christian Kratky 2016-2019</copyright>
|
||||||
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
|
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace MQTTnet.Extensions
|
|||||||
{
|
{
|
||||||
public static string GetUserProperty(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
|
public static string GetUserProperty(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
|
||||||
{
|
{
|
||||||
return message.UserProperties.SingleOrDefault(up => up.Name.Equals(propertyName, comparisonType))?.Value;
|
return message?.UserProperties?.SingleOrDefault(up => up.Name.Equals(propertyName, comparisonType))?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T GetUserProperty<T>(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
|
public static T GetUserProperty<T>(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
|
||||||
|
|||||||
Reference in New Issue
Block a user