From 1c84586dbfa44ec74213860cc24a6f9a680a0917 Mon Sep 17 00:00:00 2001 From: salaros Date: Fri, 8 Jun 2018 17:40:44 +0300 Subject: [PATCH] implements #7 - Add more constructors to SharedParameterFile class enhancement --- src/Parameters/Shared/SharedParameterFile.cs | 41 +++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Parameters/Shared/SharedParameterFile.cs b/src/Parameters/Shared/SharedParameterFile.cs index f3a302e..5554b95 100644 --- a/src/Parameters/Shared/SharedParameterFile.cs +++ b/src/Parameters/Shared/SharedParameterFile.cs @@ -22,7 +22,14 @@ public sealed partial class SharedParameterFile : ICloneable, IEquatable _groups; + private IReadOnlyList _groups; + + internal SharedParameterFile() + { + Metadata = new MetaData(2, 1); + Parameters = new ParameterCollection(this, null); + _groups = new List(); + } /// /// Initializes a new instance of the class. @@ -37,6 +44,38 @@ public SharedParameterFile(IEnumerable groups = null, IEnumerable(groups) : new List(); } + /// + /// Initializes a new instance of the class. + /// + /// The list of groups. + /// The list of parameters. + /// The metadata section. + /// + public SharedParameterFile(IEnumerable groups = null, IEnumerable parameters = null, MetaData metadata = null) + : this( + groups?.Select((g, i) => new Group(g, i +1)), + parameters, + metadata + ) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The list of groups. + /// The list of parameters. + /// The metadata section. + /// + public SharedParameterFile(IDictionary groups = null, IEnumerable parameters = null, MetaData metadata = null) + : this( + groups?.Select((g, i) => new Group(g.Key, (g.Value > 0) ? g.Value : i)), + parameters, + metadata + ) + { + } + /// /// Initializes a new instance of the class. ///