Hey.

There are a number of objects with different implementations, but a single interface:

public interface IComponent<Tin, Tout> where Tin : struct where Tout : struct { IParameters<Tin, Tout> ComponentParameters { get; } ... } 

Tin, Tout - enum'y, separate for each type of object. They contain a list of parameters required for the organization of dictionaries:

 public interface IParameters<Tin, Tout> where Tin : struct where Tout : struct { Dictionary<Tin, string> InputStruct { get; } Dictionary<Tout, string> OutputStruct { get; } } 

Objects are the constituent elements of a compound object. At the moment, this is partially implemented as a set of fields and properties:

 private List<Component1> _cmp1; // Component1 : IParameters<Tin1, Tout1> private List<Component2> _cmp2; // Component2 : IParameters<Tin2, Tout2> ... public List<Component1> Comp1 { get { return _cmp1; } set { _cmp1 = value; } } public List<Component2> Comp2 { get { return _cmp2; } set { _cmp2 = value; } } ... 

, and a set of fields and methods of access to them:

 private List<Component3> _cmp3; private List<Component4> _cmp4; ... public List<T> GetComponent34<T>() { ... } public int SetComponent34<T>(List<T> value) { ... } 

Each type of object is based in a separate assembly. I want to separate the implementation of the compound object from the features of the components that do not allow to push them all, for example, in one list. The main ones are naturally enums. However, how to do this, something does not come to my head.

PS It is also quite possible that the lists of parameters will not be loaded from enums, but from an external source, but for now I would like to resolve the issue with enums.

  • Can you try again to explain the problem in another way? What builds are based on and what should be trimmed from. I've read it three times and never understood ... - andreycha
  • @andreycha, let's say there are assemblies: Component1.dll Component2.dll ... In each of the assemblies, the corresponding ComponentX is defined that implements the IComponent <Tin, Tout> interface. For each ComponentX, there are its own enum EnumInX and EnumOutX , which are substituted into the interface parameters. Accordingly, if you try to stuff Component1 , Component2 , etc. in one List, differing EnumIn (Out) 1 , EnumIn (Out) 2 , etc. will not allow to do this. - bonArt
  • @andrey, are there really no useable ways to bring these enums to the same interface? - bonArt
  • And what type of list do you use? List<IComponent<???, ???>> - what do you want to specify as parameter types? - andreycha
  • @andrey, higher on the topic. Dictionary. And the types are enum. - bonArt

1 answer 1

In general, I left the problem by changing the type of keys in the dictionaries to string.