I have a base class for nodes:
public abstract class Node
{
public virtual string Id { get; set; }
public abstract string Type { get; }
}
And have my other node classes like this
public class Item : Node
{
public string Name {get; set;}
public string ItemNumber {get; set;}
public override string Type
{
get { return "Item"; }
}
}
There are many other classes like the Item
class that represent different node types, how would i create a method that you pass the node type in and the method then creates that specific node?
Look at the Factory Method creational pattern.