internal NodeTypeProperty(NodeType nodeType, PropertyInfo info) : base(info) { this.nodeType = nodeType; this.info = info; var defaultValueAttribute = info.GetCustomAttribute<DefaultValueAttribute>(true); if (defaultValueAttribute != null) defaultValue = defaultValueAttribute.Value; }
/// <summary>Get the <see cref="NodeType"/> for a <see cref="System.Type"/>.</summary> /// <param name="type"></param> /// <returns></returns> public static NodeType GetNodeType(Type type) { NodeType nodeType; if (NodeTypes.TryGetValue(type, out nodeType)) return nodeType; if (type == null) throw new ArgumentNullException("type"); if (!type.IsSubclassOf(typeof(Node))) throw new ArgumentException("Type " + type.Name + " is not a sub-class of " + typeof(Node).Name); return NodeTypes[type] = nodeType = new NodeType(type); }