@@ -234,8 +234,7 @@ internal static Entry[]?[] Lookup
234234 /// Indicates whether this instance matches the <typeparamref name="TEnum"/> value of <paramref name="other"/>.
235235 /// </summary>
236236 /// <returns>true if <paramref name="other"/>'s <typeparamref name="TEnum"/> value and this instance's <typeparamref name="TEnum"/> value are the same; otherwise false.</returns>
237- public bool Equals ( EnumValue < TEnum > other )
238- => Value . Equals ( other . Value ) ;
237+ public bool Equals ( EnumValue < TEnum > other ) => Value . Equals ( other . Value ) ;
239238
240239 /// <summary>
241240 /// Compares an <see cref="EnumValue{TEnum}"/> and <see cref="EnumValueCaseIgnored{TEnum}"/> for <typeparamref name="TEnum"/> equality.
@@ -250,8 +249,7 @@ public bool Equals(EnumValue<TEnum> other)
250249 => ! left . Value . Equals ( right . Value ) ;
251250
252251 /// <inheritdoc cref="Equals(EnumValue{TEnum})"/>
253- public bool Equals ( EnumValueCaseIgnored < TEnum > other )
254- => Value . Equals ( other . Value ) ;
252+ public bool Equals ( EnumValueCaseIgnored < TEnum > other ) => Value . Equals ( other . Value ) ;
255253
256254 /// <summary>
257255 /// Compares two <see cref="EnumValue{TEnum}"/> for <typeparamref name="TEnum"/> equality.
@@ -269,8 +267,7 @@ public bool Equals(EnumValueCaseIgnored<TEnum> other)
269267 /// Indicates whether this instance matches the provided enum <paramref name="other"/>.
270268 /// </summary>
271269 /// <returns>true if <paramref name="other"/> and this instance's enum value are the same; otherwise false.</returns>
272- public bool Equals ( TEnum ? other )
273- => Value . Equals ( other ) ;
270+ public bool Equals ( TEnum ? other ) => Value . Equals ( other ) ;
274271
275272 /// <summary>
276273 /// Compares an <see cref="EnumValue{TEnum}"/> and a <typeparamref name="TEnum"/> value forequality.
@@ -285,10 +282,9 @@ public bool Equals(TEnum? other)
285282 => ! left . Value . Equals ( right ) ;
286283
287284 /// <inheritdoc />
288- public override bool Equals ( object ? obj )
289- => obj is TEnum e && Value . Equals ( e )
290- || obj is EnumValue < TEnum > v1 && Value . Equals ( v1 . Value )
291- || obj is EnumValueCaseIgnored < TEnum > v2 && Value . Equals ( v2 . Value ) ;
285+ public override bool Equals ( object ? obj ) => obj is TEnum e && Value . Equals ( e )
286+ || obj is EnumValue < TEnum > v1 && Value . Equals ( v1 . Value )
287+ || obj is EnumValueCaseIgnored < TEnum > v2 && Value . Equals ( v2 . Value ) ;
292288
293289 /// <inheritdoc />
294290 public override int GetHashCode ( ) => Value . GetHashCode ( ) ;
@@ -342,15 +338,13 @@ static Underlying()
342338 /// </summary>
343339 [ SuppressMessage ( "Roslynator" , "RCS1158:Static member in generic type should use a type parameter." ) ]
344340 public static bool IsDefined < T > ( T value )
345- where T : notnull
346- => Underlying < T > . Map . ContainsKey ( value ) ;
341+ where T : notnull => Underlying < T > . Map . ContainsKey ( value ) ;
347342
348343 /// <summary>
349344 /// Returns the <typeparamref name="TEnum"/> from the <paramref name="value"/> provided if it maps directly to the underlying value.
350345 /// </summary>
351346 public static bool TryGetValue < T > ( T value , out TEnum e )
352- where T : notnull
353- => Underlying < T > . Map . TryGetValue ( value , out e ! ) ;
347+ where T : notnull => Underlying < T > . Map . TryGetValue ( value , out e ! ) ;
354348
355349 private string GetDebuggerDisplay ( )
356350 {
@@ -400,8 +394,7 @@ public readonly struct EnumValueCaseIgnored<TEnum>
400394 => ! left . Value . Equals ( right . Value ) ;
401395
402396 /// <inheritdoc cref="EnumValue{TEnum}.Equals(EnumValue{TEnum})"/>
403- public bool Equals ( EnumValueCaseIgnored < TEnum > other )
404- => Value . Equals ( other . Value ) ;
397+ public bool Equals ( EnumValueCaseIgnored < TEnum > other ) => Value . Equals ( other . Value ) ;
405398
406399 /// <summary>
407400 /// Compares two <see cref="EnumValueCaseIgnored{TEnum}"/> for <typeparamref name="TEnum"/> equality.
@@ -416,8 +409,7 @@ public bool Equals(EnumValueCaseIgnored<TEnum> other)
416409 => ! left . Value . Equals ( right . Value ) ;
417410
418411 /// <inheritdoc cref="EnumValue{TEnum}.Equals(TEnum)"/>
419- public bool Equals ( TEnum ? other )
420- => Value . Equals ( other ) ;
412+ public bool Equals ( TEnum ? other ) => Value . Equals ( other ) ;
421413
422414 /// <summary>
423415 /// Compares an <see cref="EnumValueCaseIgnored{TEnum}"/> and a <typeparamref name="TEnum"/> value for equality.
@@ -432,14 +424,12 @@ public bool Equals(TEnum? other)
432424 => ! left . Value . Equals ( right ) ;
433425
434426 /// <inheritdoc />
435- public override bool Equals ( object ? obj )
436- => obj is TEnum e && Value . Equals ( e )
437- || obj is EnumValueCaseIgnored < TEnum > v1 && Value . Equals ( v1 . Value )
438- || obj is EnumValue < TEnum > v2 && Value . Equals ( v2 . Value ) ;
427+ public override bool Equals ( object ? obj ) => obj is TEnum e && Value . Equals ( e )
428+ || obj is EnumValueCaseIgnored < TEnum > v1 && Value . Equals ( v1 . Value )
429+ || obj is EnumValue < TEnum > v2 && Value . Equals ( v2 . Value ) ;
439430
440431 /// <inheritdoc />
441- public override int GetHashCode ( )
442- => Value . GetHashCode ( ) ;
432+ public override int GetHashCode ( ) => Value . GetHashCode ( ) ;
443433
444434 /// <summary>
445435 /// Implicitly converts an <see cref="EnumValue{TEnum}"/> to an <see cref="EnumValueCaseIgnored{TEnum}"/>.
@@ -515,18 +505,16 @@ public static bool TryParse<TEnum>(string value, out TEnum e)
515505 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
516506 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
517507 public static TEnum Parse < TEnum > ( StringSegment value )
518- where TEnum : notnull , Enum
519- => TryParse < TEnum > ( value , false , out TEnum ? e ) ? e
520- : throw new ArgumentException ( string . Format ( NotFoundMessage , value ) , nameof ( value ) ) ;
508+ where TEnum : notnull , Enum => TryParse < TEnum > ( value , false , out TEnum ? e ) ? e
509+ : throw new ArgumentException ( string . Format ( NotFoundMessage , value ) , nameof ( value ) ) ;
521510
522511 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
523512 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
524513 public static TEnum Parse < TEnum > ( string value , bool ignoreCase )
525- where TEnum : notnull , Enum
526- => ignoreCase
527- ? EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( value , out TEnum ? e ) ? e
528- : throw new ArgumentException ( string . Format ( NotFoundMessage , value ) , nameof ( value ) )
529- : Parse < TEnum > ( value ) ;
514+ where TEnum : notnull , Enum => ignoreCase
515+ ? EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( value , out TEnum ? e ) ? e
516+ : throw new ArgumentException ( string . Format ( NotFoundMessage , value ) , nameof ( value ) )
517+ : Parse < TEnum > ( value ) ;
530518
531519 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
532520 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
@@ -543,23 +531,20 @@ public static TEnum Parse<TEnum>(StringSegment value, bool ignoreCase)
543531 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
544532 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
545533 public static bool TryParse < TEnum > ( StringSegment value , out TEnum e )
546- where TEnum : notnull , Enum
547- => TryParse ( value , false , out e ) ;
534+ where TEnum : notnull , Enum => TryParse ( value , false , out e ) ;
548535
549536 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
550537 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
551538 public static bool TryParse < TEnum > ( string name , bool ignoreCase , out TEnum e )
552- where TEnum : notnull , Enum
553- => ignoreCase
554- ? EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! )
555- : TryParse ( name , out e ) ;
539+ where TEnum : notnull , Enum => ignoreCase
540+ ? EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! )
541+ : TryParse ( name , out e ) ;
556542
557543 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
558544 /// <remarks>Can be slightly faster than other ignore-case methods.</remarks>
559545 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
560546 public static bool TryParseIgnoreCase < TEnum > ( string name , out TEnum e )
561- where TEnum : notnull , Enum
562- => EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! ) ;
547+ where TEnum : notnull , Enum => EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! ) ;
563548
564549 /// <summary>
565550 /// Converts the string representation of the name of one or more enumerated constants to an equivalent enumerated object.
@@ -609,8 +594,7 @@ public static bool TryParse<TEnum>(StringSegment name, bool ignoreCase, out TEnu
609594 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
610595 public static bool TryGetValue < TEnum , T > ( T value , out TEnum e )
611596 where TEnum : notnull , Enum
612- where T : notnull
613- => EnumValue < TEnum > . TryGetValue ( value , out e ) ;
597+ where T : notnull => EnumValue < TEnum > . TryGetValue ( value , out e ) ;
614598
615599 /// <summary>
616600 /// Uses an expression tree to do an fast lookup the name of the enum value.
@@ -621,8 +605,7 @@ public static bool TryGetValue<TEnum, T>(T value, out TEnum e)
621605 /// <returns>The name of the enum.</returns>
622606 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
623607 public static string GetName < TEnum > ( this TEnum value )
624- where TEnum : notnull , Enum
625- => EnumValue < TEnum > . NameLookup ( value ) ;
608+ where TEnum : notnull , Enum => EnumValue < TEnum > . NameLookup ( value ) ;
626609
627610 /// <summary>
628611 /// Retrieves the attributes for a given enum value.
0 commit comments