From dea70843c584e9cb2e94157a501a9e4628fb7952 Mon Sep 17 00:00:00 2001 From: Andy Howard Date: Thu, 16 Jan 2025 13:20:10 +0000 Subject: [PATCH] BusinessMgr --- SacsStandardBase/Base/Core/CodeDesc.cs | 2 +- SacsStandardBase/Base/Core/TypeCodeDesc.cs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/SacsStandardBase/Base/Core/CodeDesc.cs b/SacsStandardBase/Base/Core/CodeDesc.cs index f121021..5028bc7 100644 --- a/SacsStandardBase/Base/Core/CodeDesc.cs +++ b/SacsStandardBase/Base/Core/CodeDesc.cs @@ -10,7 +10,7 @@ namespace Sarand.Net.Standard.Base.Core //------------------------------------------------------------------- // Data members. //------------------------------------------------------------------- - public CodeDesc (String code, String desc, String comment = "") + public CodeDesc(String code, String desc, String comment = "") { Code = StringUtil.EmptyOnNull(code); Desc = StringUtil.EmptyOnNull(desc); diff --git a/SacsStandardBase/Base/Core/TypeCodeDesc.cs b/SacsStandardBase/Base/Core/TypeCodeDesc.cs index 970c2d1..a232b6d 100644 --- a/SacsStandardBase/Base/Core/TypeCodeDesc.cs +++ b/SacsStandardBase/Base/Core/TypeCodeDesc.cs @@ -9,14 +9,21 @@ namespace Sarand.Net.Standard.Base.Core { //------------------------------------------------------------------- // Construction. - public TypeCodeDesc (int type, String code, String desc, String comment = "") : + public TypeCodeDesc(int type, String code, String desc, String comment = "") : base(code, desc, comment) { Type = type; } - //------------------------------------------------------------------- + + /// Generic initialisation, ie. with type as enum. + public static TypeCodeDesc Create(T type, String code, string desc, string comment = "") where T : struct, IConvertible + { + return new TypeCodeDesc((int)(type as IConvertible), code, desc, comment); + } + // Properties. public int Type { get; } + //------------------------------------------------------------------- }