Skip to content

Commit db1a5bc

Browse files
committed
Refactoring
1 parent 749ef30 commit db1a5bc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

crypto/src/AssemblyInfo.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282

8383
internal class AssemblyInfo
8484
{
85-
private static string version;
85+
private static string version = null;
86+
8687
public static string Version
8788
{
8889
get
@@ -91,21 +92,26 @@ public static string Version
9192
{
9293
#if PORTABLE
9394
#if NEW_REFLECTION
94-
var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).GetTypeInfo().Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute)).FirstOrDefault();
95+
var a = typeof(AssemblyInfo).GetTypeInfo().Assembly;
96+
var c = a.GetCustomAttributes(typeof(AssemblyVersionAttribute));
9597
#else
96-
var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false).FirstOrDefault();
98+
var a = typeof(AssemblyInfo).Assembly;
99+
var c = a.GetCustomAttributes(typeof(AssemblyVersionAttribute), false);
97100
#endif
98-
if (ver != null)
101+
var v = (AssemblyVersionAttribute)c.FirstOrDefault();
102+
if (v != null)
99103
{
100-
version = ver.Version;
104+
version = v.Version;
101105
}
102106
#else
103107
version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
104108
#endif
105109

106110
// if we're still here, then don't try again
107111
if (version == null)
112+
{
108113
version = string.Empty;
114+
}
109115
}
110116

111117
return version;

0 commit comments

Comments
 (0)