File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // The following comment is required to instruct analyzers to skip this file
2+ // <auto-generated/>
3+
4+ #if ( NETFRAMEWORK && ! NET40_OR_GREATER )
5+ #nullable enable
6+ // ReSharper disable RedundantUsingDirective
7+ // ReSharper disable CheckNamespace
8+ // ReSharper disable InconsistentNaming
9+ // ReSharper disable PartialTypeWithSinglePart
10+
11+ using System ;
12+
13+ internal static partial class PolyfillExtensions
14+ {
15+ extension ( Version )
16+ {
17+ // https://learn.microsoft.com/dotnet/api/system.version.parse
18+ public static Version Parse ( string input ) => new ( input ) ;
19+
20+ // https://learn.microsoft.com/dotnet/api/system.version.tryparse
21+ public static bool TryParse ( string ? input , out Version ? result )
22+ {
23+ result = null ;
24+ if ( input is null )
25+ return false ;
26+
27+ try
28+ {
29+ result = new Version ( input ) ;
30+ return true ;
31+ }
32+ catch
33+ {
34+ return false ;
35+ }
36+ }
37+ }
38+ }
39+ #endif
You can’t perform that action at this time.
0 commit comments