From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001
From: giy <giy@omp-system.ru>
Date: Fri, 02 Sep 2022 14:16:56 +0300
Subject: [PATCH] Обновление до версии 2.9.0
---
QtVsTools.Core/Common/EnumExt.cs | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/QtVsTools.Core/Common/EnumExt.cs b/QtVsTools.Core/Common/EnumExt.cs
index 0406e2c..c05f7bc 100644
--- a/QtVsTools.Core/Common/EnumExt.cs
+++ b/QtVsTools.Core/Common/EnumExt.cs
@@ -40,6 +40,8 @@
/// </summary>
public static class EnumExt
{
+ static LazyFactory StaticLazy { get; } = new LazyFactory();
+
/// <summary>
/// Wrapper for enum cast values.
/// </summary>
@@ -64,7 +66,7 @@
[AttributeUsage(AttributeTargets.All)]
public sealed class StringAttribute : Attribute, ICast<string>
{
- public string Value { get; private set; }
+ public string Value { get; }
public StringAttribute(string str) { Value = str; }
}
@@ -128,8 +130,7 @@
/// </summary>
public static TEnum Cast<T, TEnum>(this T valueT, TEnum defaultValue) where TEnum : struct
{
- TEnum value;
- return TryCast(valueT, out value) ? value : defaultValue;
+ return TryCast(valueT, out TEnum value) ? value : defaultValue;
}
/// <summary>
@@ -201,15 +202,14 @@
.FirstOrDefault();
}
- static IEnumerable<Type> _CastAttribTypes;
/// <summary>
/// List of cast attribute types.
/// </summary>
/// <remarks>
/// Future cast attribute types need to be added to this list.
/// </remarks>
- static IEnumerable<Type> CastAttribTypes => _CastAttribTypes
- ?? (_CastAttribTypes = new[]
+ static IEnumerable<Type> CastAttribTypes => StaticLazy.Get(() =>
+ CastAttribTypes, () => new[]
{
typeof(StringAttribute)
});
--
Gitblit v1.9.1