1- // Ignore Spelling: Deconstruct
2-
3- using Microsoft . Extensions . Primitives ;
4- using System ;
5- using System . Collections . Concurrent ;
6- using System . Collections . Generic ;
7- using System . Diagnostics ;
8- using System . Diagnostics . CodeAnalysis ;
9- using System . Linq ;
1+ using System . Collections . Concurrent ;
102using System . Linq . Expressions ;
11- using System . Runtime . CompilerServices ;
12- using System . Threading ;
133using static System . Linq . Expressions . Expression ;
144//using static FastExpressionCompiler.LightExpression.Expression;
155namespace Open . Text ;
@@ -366,8 +356,8 @@ public static bool IsDefined<T>(T value)
366356 /// Returns the <typeparamref name="TEnum"/> from the <paramref name="value"/> provided if it maps directly to the underlying value.
367357 /// </summary>
368358 public static bool TryGetValue < T > ( T value , out TEnum e )
369- where T : notnull
370- => Underlying < T > . Map . TryGetValue ( value , out e ! ) ;
359+ where T : notnull
360+ => Underlying < T > . Map . TryGetValue ( value , out e ! ) ;
371361
372362 private string GetDebuggerDisplay ( )
373363 {
@@ -533,7 +523,7 @@ public static bool TryParse<TEnum>(string value, out TEnum e)
533523 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
534524 public static TEnum Parse < TEnum > ( StringSegment value )
535525 where TEnum : notnull , Enum
536- => TryParse < TEnum > ( value , false , out var e ) ? e
526+ => TryParse < TEnum > ( value , false , out var e ) ? e
537527 : throw new ArgumentException ( string . Format ( NotFoundMessage , value ) , nameof ( value ) ) ;
538528
539529 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
@@ -549,7 +539,7 @@ public static TEnum Parse<TEnum>(string value, bool ignoreCase)
549539 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
550540 public static TEnum Parse < TEnum > ( StringSegment value , bool ignoreCase )
551541 where TEnum : notnull , Enum
552- {
542+ {
553543 var buffer = value . Buffer ?? throw new ArgumentNullException ( nameof ( value ) ) ;
554544 return value . Length == buffer . Length
555545 ? Parse < TEnum > ( value . Buffer , ignoreCase )
@@ -561,13 +551,13 @@ public static TEnum Parse<TEnum>(StringSegment value, bool ignoreCase)
561551 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
562552 public static bool TryParse < TEnum > ( StringSegment value , out TEnum e )
563553 where TEnum : notnull , Enum
564- => TryParse ( value , false , out e ) ;
554+ => TryParse ( value , false , out e ) ;
565555
566556 /// <inheritdoc cref="TryParse{TEnum}(StringSegment, bool, out TEnum)"/>
567557 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
568558 public static bool TryParse < TEnum > ( string name , bool ignoreCase , out TEnum e )
569559 where TEnum : notnull , Enum
570- => ignoreCase
560+ => ignoreCase
571561 ? EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! )
572562 : TryParse ( name , out e ) ;
573563
@@ -576,7 +566,7 @@ public static bool TryParse<TEnum>(string name, bool ignoreCase, out TEnum e)
576566 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
577567 public static bool TryParseIgnoreCase < TEnum > ( string name , out TEnum e )
578568 where TEnum : notnull , Enum
579- => EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! ) ;
569+ => EnumValue < TEnum > . IgnoreCaseLookup . TryGetValue ( name , out e ! ) ;
580570
581571 /// <summary>
582572 /// Converts the string representation of the name of one or more enumerated constants to an equivalent enumerated object.
@@ -587,7 +577,7 @@ public static bool TryParseIgnoreCase<TEnum>(string name, out TEnum e)
587577 /// <returns>true if the value was found; otherwise false.</returns>
588578 public static bool TryParse < TEnum > ( StringSegment name , bool ignoreCase , out TEnum e )
589579 where TEnum : notnull , Enum
590- {
580+ {
591581 var len = name . Length ;
592582 if ( len == 0 ) goto notFound ;
593583
@@ -626,8 +616,8 @@ public static bool TryParse<TEnum>(StringSegment name, bool ignoreCase, out TEnu
626616 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
627617 public static bool TryGetValue < TEnum , T > ( T value , out TEnum e )
628618 where TEnum : notnull , Enum
629- where T : notnull
630- => EnumValue < TEnum > . TryGetValue ( value , out e ) ;
619+ where T : notnull
620+ => EnumValue < TEnum > . TryGetValue ( value , out e ) ;
631621
632622 /// <summary>
633623 /// Uses an expression tree to do an fast lookup the name of the enum value.
@@ -639,14 +629,14 @@ public static bool TryGetValue<TEnum, T>(T value, out TEnum e)
639629 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
640630 public static string GetName < TEnum > ( this TEnum value )
641631 where TEnum : notnull , Enum
642- => EnumValue < TEnum > . NameLookup ( value ) ;
632+ => EnumValue < TEnum > . NameLookup ( value ) ;
643633
644634 /// <summary>
645635 /// Retrieves the attributes for a given enum value.
646636 /// </summary>
647637 public static IReadOnlyList < Attribute > GetAttributes < TEnum > ( this TEnum value )
648638 where TEnum : notnull , Enum
649- {
639+ {
650640 return EnumValue < TEnum > . Attributes . GetOrAdd ( value , GetAttributesCore ) ;
651641
652642 static IReadOnlyList < Attribute > GetAttributesCore ( TEnum value )
0 commit comments