@@ -225,7 +225,7 @@ public static bool TryReadFromBytes(byte[] data, ref int offset, bool isStrict,
225225 /// Converts this value to its byte array representation.
226226 /// </summary>
227227 /// <returns>An array of bytes in big-endian order</returns>
228- public byte [ ] ToByteArray ( )
228+ public readonly byte [ ] ToByteArray ( )
229229 {
230230 if ( badEncoding != null )
231231 {
@@ -316,7 +316,7 @@ public static explicit operator int(DerInt val)
316316 /// </summary>
317317 /// <param name="other">Other <see cref="DerInt"/> to compare to this instance.</param>
318318 /// <returns>-1 if smaller, 0 if equal and 1 if bigger.</returns>
319- public int CompareTo ( DerInt other )
319+ public readonly int CompareTo ( DerInt other )
320320 {
321321 return value . CompareTo ( other . value ) ;
322322 }
@@ -328,11 +328,11 @@ public int CompareTo(DerInt other)
328328 /// <exception cref="ArgumentException"/>
329329 /// <param name="obj">The object to compare to this instance.</param>
330330 /// <returns>-1 if smaller, 0 if equal and 1 if bigger</returns>
331- public int CompareTo ( object obj )
331+ public readonly int CompareTo ( object obj )
332332 {
333333 if ( obj is null )
334334 return 1 ;
335- if ( ! ( obj is DerInt ) )
335+ if ( obj is not DerInt )
336336 throw new ArgumentException ( $ "Object must be of type { nameof ( DerInt ) } ") ;
337337
338338 return CompareTo ( ( DerInt ) obj ) ;
@@ -343,7 +343,7 @@ public int CompareTo(object obj)
343343 /// </summary>
344344 /// <param name="other">Other <see cref="DerInt"/> value to compare to this instance.</param>
345345 /// <returns>true if the value is equal to the value of this instance; otherwise, false.</returns>
346- public bool Equals ( DerInt other )
346+ public readonly bool Equals ( DerInt other )
347347 {
348348 return CompareTo ( other ) == 0 ;
349349 }
@@ -357,9 +357,9 @@ public bool Equals(DerInt other)
357357 /// true if value is an instance of <see cref="DerInt"/>
358358 /// and equals the value of this instance; otherwise, false.
359359 /// </returns>
360- public override bool Equals ( object obj )
360+ public override readonly bool Equals ( object obj )
361361 {
362- if ( ! ( obj is DerInt ) )
362+ if ( obj is not DerInt )
363363 throw new ArgumentException ( $ "Object must be of type { nameof ( DerInt ) } ") ;
364364
365365 return Equals ( ( DerInt ) obj ) ;
@@ -369,7 +369,7 @@ public override bool Equals(object obj)
369369 /// Returns the hash code for this instance.
370370 /// </summary>
371371 /// <returns>A 32-bit signed integer hash code</returns>
372- public override int GetHashCode ( )
372+ public override readonly int GetHashCode ( )
373373 {
374374 return value . GetHashCode ( ) ;
375375 }
@@ -378,7 +378,7 @@ public override int GetHashCode()
378378 /// Converts the value of the current instance to its equivalent string representation.
379379 /// </summary>
380380 /// <returns>A string representation of the value of the current instance</returns>
381- public override string ToString ( )
381+ public override readonly string ToString ( )
382382 {
383383 return value . ToString ( ) ;
384384 }
0 commit comments