コード例 #1
0
        /// <summary>
        /// Creates and adds a new field.
        /// </summary>
        /// <param name="me">component descriptor to host the new field</param>
        /// <param name="type">type descriptor of the new field</param>
        /// <param name="name">name of the new field</param>
        /// <returns>the descriptor of the new field</returns>
        public static DOMFieldBuilder CreateField(this IComponentDescriptor me,
                                                  TypeDescriptor type, string name)
        {
            Contract.Requires <ArgumentNullException>(me != null);
            Contract.Requires <ArgumentNullException>(type != null);
            Contract.Requires <ArgumentNullException>(name != null);

            var fb = new DOMFieldBuilder(type);

            me.AddChild(fb, name);
            return(fb);
        }
コード例 #2
0
        /// <summary>
        /// Creates and adds a new field.
        /// </summary>
        /// <param name="me">component descriptor to host the new field</param>
        /// <param name="type">type descriptor of the new field</param>
        /// <param name="initialValue">initial field value</param>
        /// <param name="name">name of the new field</param>
        /// <returns>the descriptor of the new field</returns>
        public static DOMFieldBuilder CreateField(this IComponentDescriptor me,
                                                  TypeDescriptor type, object initialValue, string name)
        {
            Contract.Requires <ArgumentNullException>(me != null);
            Contract.Requires <ArgumentNullException>(type != null);
            Contract.Requires <ArgumentNullException>(name != null);
            Contract.Requires <ArgumentException>(initialValue == null || TypeDescriptor.GetTypeOf(initialValue).Equals(type), "Field type must match type of initial value");

            var fb = new DOMFieldBuilder(type, initialValue);

            me.AddChild(fb, name);
            return(fb);
        }
コード例 #3
0
ファイル: Builders.cs プロジェクト: venusdharan/systemsharp
        /// <summary>
        /// Creates and adds a new field.
        /// </summary>
        /// <param name="me">component descriptor to host the new field</param>
        /// <param name="type">type descriptor of the new field</param>
        /// <param name="initialValue">initial field value</param>
        /// <param name="name">name of the new field</param>
        /// <returns>the descriptor of the new field</returns>
        public static DOMFieldBuilder CreateField(this IComponentDescriptor me,
            TypeDescriptor type, object initialValue, string name)
        {
            Contract.Requires<ArgumentNullException>(me != null);
            Contract.Requires<ArgumentNullException>(type != null);
            Contract.Requires<ArgumentNullException>(name != null);
            Contract.Requires<ArgumentException>(initialValue == null || TypeDescriptor.GetTypeOf(initialValue).Equals(type), "Field type must match type of initial value");

            var fb = new DOMFieldBuilder(type, initialValue);
            me.AddChild(fb, name);
            return fb;
        }
コード例 #4
0
ファイル: Builders.cs プロジェクト: venusdharan/systemsharp
        /// <summary>
        /// Creates and adds a new field.
        /// </summary>
        /// <param name="me">component descriptor to host the new field</param>
        /// <param name="type">type descriptor of the new field</param>
        /// <param name="name">name of the new field</param>
        /// <returns>the descriptor of the new field</returns>
        public static DOMFieldBuilder CreateField(this IComponentDescriptor me,
            TypeDescriptor type, string name)
        {
            Contract.Requires<ArgumentNullException>(me != null);
            Contract.Requires<ArgumentNullException>(type != null);
            Contract.Requires<ArgumentNullException>(name != null);

            var fb = new DOMFieldBuilder(type);
            me.AddChild(fb, name);
            return fb;
        }