❔ Is there a pattern for having a single collection of different object types?
This is my sample code https://dotnetfiddle.net/ffV3vY I have a WorkflowCommand a ScheduledWorkflowCommanddepending on their type they are executed in different ways. I would like to have a collection of them I can pass around and enumerate.
Help Creating List of two types | C# Online Compiler | .NET Fiddle
Help Creating List of two types | Test your C# code online with .NET Fiddle code editor.
5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@TeBeClone Can you fork the fiddle and show me?
Or are you saying its as simple as:
Before:
after
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@TeBeClone I think I have a working example now: https://dotnetfiddle.net/drzai7
Question, is there a way to take an existing command (
public class Command2 : WorkflowCommand
) and convert it to a ScheduledWorkflowCommand
without defining a new class?[Fork] Help Creating List of two types | C# Online Compiler | .NET ...
[Fork] Help Creating List of two types | Test your C# code online with .NET Fiddle code editor.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.