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; } + //------------------------------------------------------------------- }