CreateInstance() public méthode

public CreateInstance ( Node parent ) : Node
parent Node
Résultat Node
Exemple #1
0
        // -------------------------------------------------------------------------------- Node Factory

        public static Node CreateInstance(string nodeTypeName, Node parent)
        {
            if (nodeTypeName == null)
            {
                throw new ArgumentNullException("nodeTypeName");
            }
            if (nodeTypeName.Length == 0)
            {
                throw new ArgumentOutOfRangeException("nodeTypeName", "Argument cannot be empty");
            }

            NodeType nodeType = NodeTypeManager.Current.NodeTypes[nodeTypeName];

            if (nodeType == null)
            {
                throw new ApplicationException(String.Concat("NodeType not found: ", nodeTypeName));
            }

            return(nodeType.CreateInstance(parent));
        }