NClass.Core.Member.InitFromString C# (CSharp) Method

InitFromString() public abstract method

/// The does not fit to the syntax. ///
public abstract InitFromString ( string declaration ) : void
declaration string
return void
		public abstract void InitFromString(string declaration);

Usage Example

Ejemplo n.º 1
0
        /// <exception cref="ArgumentException">
        /// <paramref name="memberType"/> is empty string.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="list"/> is null.-or-
        /// <paramref name="memberType"/> is null.-or-
        /// <paramref name="node"/> is null.-or-
        /// <paramref name="parent"/> is null.
        /// </exception>
        internal static void LoadMembers <T>(IList <T> list, string memberType, XmlNode node,
                                             OperationContainer parent) where T : Member
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }
            if (memberType == null)
            {
                throw new ArgumentNullException("memberType");
            }
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            if (memberType == "")
            {
                throw new ArgumentException(
                          "error_empty_string", "memberType");
            }

            XmlElement child = node[memberType];

            while (child != null)
            {
                if (child.Name == memberType)
                {
                    string name = child.GetAttribute("name");
                    string type = child.GetAttribute("type");
                    try
                    {
                        Member member = GetMemberFromName(type, name, parent);
                        member.InitFromString(child.InnerText);
                        list.Add((T)member);
                    }
                    catch
                    {
                        // Skips incorrect node
                    }
                }
                child = child.NextSibling as XmlElement;
            }
        }