示例#1
0
        /// <summary>
        /// Adds the specified <see cref="XliffElement"/> to this object in the appropriate place depending on
        /// the type and attributes.
        /// </summary>
        /// <param name="name">The name of the child to add.</param>
        /// <param name="child">The <see cref="XliffElement"/> to add.</param>
        void IXliffDataConsumer.AddXliffChild(XmlNameInfo name, IXliffDataConsumer child)
        {
            ArgValidator validator;

            validator = ArgValidator.Create(child, "child").IsNotNull().IsOfType(typeof(XliffElement));

            if (this.registered)
            {
                validator.IsOfType(this.childMap.Keys);
            }

            if (!this.StoreChild(new ElementInfo(name, (XliffElement)child)))
            {
                string message;

                message = string.Format(
                    Properties.Resources.XliffElement_InvalidElement_Format,
                    child.GetType().Name,
                    this.GetType().Name);
                throw new InvalidOperationException(message);
            }
        }
示例#2
0
 /// <summary>
 /// Determines the index of a specific item in the list.
 /// </summary>
 /// <param name="item">The object to locate in the list.</param>
 /// <returns>The index of item if found in the list; otherwise, -1.</returns>
 public int IndexOf(TData item)
 {
     ArgValidator.Create(item, "item").IsNotNull();
     return(this.list.IndexOf(item));
 }