Skip to content

Commit 1d1a444

Browse files
committed
Small fixes.
1 parent ab9a548 commit 1d1a444

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

BusinessEntities/ExchangeBoard.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,14 @@ protected override bool OnEquals(ExchangeBoard other)
180180
return Code == other.Code && Exchange == other.Exchange;
181181
}
182182

183-
private int _hashCode;
183+
private int? _hashCode;
184184

185185
/// <summary>
186186
/// Get the hash code of the object <see cref="ExchangeBoard"/>.
187187
/// </summary>
188188
/// <returns>A hash code.</returns>
189189
public override int GetHashCode()
190-
{
191-
if (_hashCode == 0)
192-
_hashCode = Code.GetHashCode() ^ (Exchange == null ? 0 : Exchange.GetHashCode());
193-
194-
return _hashCode;
195-
}
190+
=> _hashCode ??= Code.GetHashCode() ^ (Exchange == null ? 0 : Exchange.GetHashCode());
196191

197192
/// <summary>
198193
/// Create a copy of <see cref="ExchangeBoard"/>.

BusinessEntities/SecurityExternalId.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ public override string ToString()
238238
/// <param name="other">Another value with which to compare.</param>
239239
/// <returns><see langword="true" />, if the specified object is equal to the current object, otherwise, <see langword="false" />.</returns>
240240
public override bool Equals(object other)
241-
{
242-
return Equals((SecurityExternalId)other);
243-
}
241+
=> other is SecurityExternalId typedOther && Equals(typedOther);
244242

245243
/// <inheritdoc />
246244
public bool Equals(SecurityExternalId other)

Messages/SecurityIdMapping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public override string ToString()
5858
/// <param name="storage">Settings storage.</param>
5959
public void Load(SettingsStorage storage)
6060
{
61-
StockSharpId = storage.GetValue<SettingsStorage>(nameof(StockSharpId)).Load<SecurityId>() ?? default;
62-
AdapterId = storage.GetValue<SettingsStorage>(nameof(AdapterId)).Load<SecurityId>() ?? default;
61+
StockSharpId = storage.GetValue<SettingsStorage>(nameof(StockSharpId)).Load<SecurityId>();
62+
AdapterId = storage.GetValue<SettingsStorage>(nameof(AdapterId)).Load<SecurityId>();
6363
}
6464

6565
/// <summary>

0 commit comments

Comments
 (0)