@@ -13,7 +13,6 @@ public PackageVersion(string version)
13
13
{
14
14
IsWildcard = true ;
15
15
}
16
-
17
16
}
18
17
19
18
public PackageVersion ( NuGetVersion ? version )
@@ -31,38 +30,20 @@ public PackageVersion(int major, int minor, int patch, int revision)
31
30
{
32
31
}
33
32
34
- private new static PackageVersion ? Parse ( string version )
35
- {
36
- if ( version . Equals ( "*" ) )
37
- {
38
- return new PackageVersion ( 0 , 0 , 0 ) ;
39
- }
40
-
41
- try
42
- {
43
- var nuGetVersion = new NuGetVersion ( version ) ;
44
- return new PackageVersion ( nuGetVersion ) ;
45
- }
46
- catch
47
- {
48
- return null ;
49
- }
50
- }
33
+ private new static PackageVersion Parse ( string version )
34
+ => version . Equals ( "*" )
35
+ ? new PackageVersion ( 0 , 0 , 0 )
36
+ : new PackageVersion ( new NuGetVersion ( version ) ) ;
51
37
52
38
public override string ToString ( )
53
- {
54
- if ( string . IsNullOrEmpty ( OriginalVersion ) || IsSemVer2 )
55
- {
56
- return ToString ( "N" , VersionFormatter . Instance ) ;
57
- }
58
-
59
- return OriginalVersion ;
60
- }
39
+ => string . IsNullOrEmpty ( OriginalVersion ) || IsSemVer2
40
+ ? ToString ( "N" , VersionFormatter . Instance )
41
+ : OriginalVersion ;
61
42
62
43
public override string ToString ( string format , IFormatProvider ? formatProvider )
63
44
{
64
45
if ( formatProvider == null
65
- || ! TryFormatter ( format , formatProvider , out var formattedString ) )
46
+ || ! TryFormatter ( format , formatProvider , out var formattedString ) )
66
47
{
67
48
formattedString = ToString ( ) ;
68
49
}
0 commit comments