public XmlCompletionDataProvider(XmlSchemaSet schemaSet, string defaultNamespace
      , string prefix = null
      , Func<string> namespaceWriter = null
      , Func<XmlSchemaElement, bool> filter = null)
    {
      var def = schemaSet.Schemas(defaultNamespace).OfType<XmlSchema>().First();

      this.schemaCompletionDataItems = new XmlSchemaCompletionDataCollection();
      foreach (var schema in schemaSet.Schemas().OfType<XmlSchema>().Where(s => s != def))
      {
        this.schemaCompletionDataItems.Add(new XmlSchemaCompletionData(schema)
        {
          ElementFilter = filter
        });
      }
      this.defaultSchemaCompletionData = new XmlSchemaCompletionData(def)
      {
        RelatedSchemas = this.schemaCompletionDataItems,
        NamespaceWriter = namespaceWriter,
        ElementFilter = filter
      };
      this.defaultNamespacePrefix = prefix ?? string.Empty;
    }
 public XmlCompletionDataProvider(XmlSchema schema)
 {
   this.schemaCompletionDataItems = new XmlSchemaCompletionDataCollection();
   this.defaultSchemaCompletionData = new XmlSchemaCompletionData(schema);
   this.defaultNamespacePrefix = string.Empty;
 }
		/// <summary>
		///   Adds a <see cref='XmlSchemaCompletionData'/> with the specified value to the 
		///   <see cref='XmlSchemaCompletionDataCollection'/>.
		/// </summary>
		/// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to add.</param>
		/// <returns>The index at which the new element was inserted.</returns>
		/// <seealso cref='XmlSchemaCompletionDataCollection.AddRange'/>
		public int Add(XmlSchemaCompletionData val)
		{
			return List.Add(val);
		}
		/// <summary>
		///   Removes a specific <see cref='XmlSchemaCompletionData'/> from the <see cref='XmlSchemaCompletionDataCollection'/>.
		/// </summary>
		/// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to remove from the <see cref='XmlSchemaCompletionDataCollection'/>.</param>
		/// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
		public void Remove(XmlSchemaCompletionData val)
		{
			List.Remove(val);
		}
		/// <summary>
		///   Initializes a new instance of <see cref='XmlSchemaCompletionDataCollection'/> containing any array of <see cref='XmlSchemaCompletionData'/> objects.
		/// </summary>
		/// <param name='val'>
		///       A array of <see cref='XmlSchemaCompletionData'/> objects with which to intialize the collection
		/// </param>
		public XmlSchemaCompletionDataCollection(XmlSchemaCompletionData[] val)
		{
			this.AddRange(val);
		}
		/// <summary>
		///   Inserts a <see cref='XmlSchemaCompletionData'/> into the <see cref='XmlSchemaCompletionDataCollection'/> at the specified index.
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
		/// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to insert.</param>
		/// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
		public void Insert(int index, XmlSchemaCompletionData val)
		{
			List.Insert(index, val);
		}
		/// <summary>
		///    Returns the index of a <see cref='XmlSchemaCompletionData'/> in 
		///       the <see cref='XmlSchemaCompletionDataCollection'/>.
		/// </summary>
		/// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to locate.</param>
		/// <returns>
		///   The index of the <see cref='XmlSchemaCompletionData'/> of <paramref name='val'/> in the 
		///   <see cref='XmlSchemaCompletionDataCollection'/>, if found; otherwise, -1.
		/// </returns>
		/// <seealso cref='XmlSchemaCompletionDataCollection.Contains'/>
		public int IndexOf(XmlSchemaCompletionData val)
		{
			return List.IndexOf(val);
		}
		/// <summary>
		///   Copies the <see cref='XmlSchemaCompletionDataCollection'/> values to a one-dimensional <see cref='Array'/> instance at the 
		///    specified index.
		/// </summary>
		/// <param name='array'>The one-dimensional <see cref='Array'/> that is the destination of the values copied from <see cref='XmlSchemaCompletionDataCollection'/>.</param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <exception cref='ArgumentException'>
		///   <para><paramref name='array'/> is multidimensional.</para>
		///   <para>-or-</para>
		///   <para>The number of elements in the <see cref='XmlSchemaCompletionDataCollection'/> is greater than
		///         the available space between <paramref name='arrayIndex'/> and the end of
		///         <paramref name='array'/>.</para>
		/// </exception>
		/// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='Array'/>
		public void CopyTo(XmlSchemaCompletionData[] array, int index)
		{
			List.CopyTo(array, index);
		}
		/// <summary>
		///   Gets a value indicating whether the 
		///    <see cref='XmlSchemaCompletionDataCollection'/> contains the specified <see cref='XmlSchemaCompletionData'/>.
		/// </summary>
		/// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to locate.</param>
		/// <returns>
		/// <see langword='true'/> if the <see cref='XmlSchemaCompletionData'/> is contained in the collection; 
		///   otherwise, <see langword='false'/>.
		/// </returns>
		/// <seealso cref='XmlSchemaCompletionDataCollection.IndexOf'/>
		public bool Contains(XmlSchemaCompletionData val)
		{
			return List.Contains(val);
		}
		/// <summary>
		///   Copies the elements of an array to the end of the <see cref='XmlSchemaCompletionDataCollection'/>.
		/// </summary>
		/// <param name='val'>
		///    An array of type <see cref='XmlSchemaCompletionData'/> containing the objects to add to the collection.
		/// </param>
		/// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
		public void AddRange(XmlSchemaCompletionData[] val)
		{
			for (int i = 0; i < val.Length; i++) {
				this.Add(val[i]);
			}
		}