Gives information about the System.Type of a Node class.
Inheritance: NodeMemberInfo
コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: NodeType.cs プロジェクト: Burton-Radons/Alexandria
        /// <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);
        }