-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVersionInfo.cs
38 lines (34 loc) · 960 Bytes
/
VersionInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Reflection;
using System.Runtime.Versioning;
namespace DotNetVersionCheck
{
public class VersionInfo
{
private string _targetFramework;
private string _runtimeVersion;
public string TargetFramework
{
get
{
if (_targetFramework == null)
{
_targetFramework = Assembly
.GetEntryAssembly()?
.GetCustomAttribute<TargetFrameworkAttribute>()?
.FrameworkName;
}
return _targetFramework;
}
}
public string RuntimeVersion
{
get
{
if (_runtimeVersion == null)
_runtimeVersion = Environment.Version.ToString();
return _runtimeVersion;
}
}
}
}