File tree Expand file tree Collapse file tree 1 file changed +3
-16
lines changed
src/LinkDotNet.Blog.Domain Expand file tree Collapse file tree 1 file changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -38,27 +38,14 @@ protected Enumeration(string key)
38
38
}
39
39
40
40
public static TEnumeration Create ( string key )
41
- {
42
- var enumeration = All . SingleOrDefault ( p => p . Key == key ) ;
43
-
44
- if ( enumeration is null )
45
- {
46
- throw new InvalidOperationException ( $ "{ key } is not a valid value for { typeof ( TEnumeration ) . Name } ") ;
47
- }
48
-
49
- return enumeration ;
50
- }
41
+ => All . SingleOrDefault ( p => p . Key == key )
42
+ ?? throw new InvalidOperationException ( $ "{ key } is not a valid value for { typeof ( TEnumeration ) . Name } ") ;
51
43
52
44
public override int GetHashCode ( ) => Key . GetHashCode ( ) ;
53
45
54
46
public override bool Equals ( object obj )
55
47
{
56
- if ( obj is null )
57
- {
58
- return false ;
59
- }
60
-
61
- if ( obj . GetType ( ) != typeof ( TEnumeration ) )
48
+ if ( obj ? . GetType ( ) != typeof ( TEnumeration ) )
62
49
{
63
50
return false ;
64
51
}
You can’t perform that action at this time.
0 commit comments