This documentation is archived and is not being maintained.

XmlSchemaSet.Schemas Method (String)

Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet that belong to the given namespace.

Namespace: System.Xml.Schema
Assembly: System.Xml (in system.xml.dll)

public ICollection Schemas (
	string targetNamespace
public ICollection Schemas (
	String targetNamespace
public function Schemas (
	targetNamespace : String
) : ICollection
Not applicable.



The schema targetNamespace property.

Return Value

An ICollection object containing all the schemas that have been added to the XmlSchemaSet that belong to the given namespace. If no schemas have been added to the XmlSchemaSet, an empty ICollection object is returned.

If the targetNamespace parameter is a null reference (Nothing in Visual Basic) or Empty, then all schemas without a namespace are returned.

This method returns schemas that were added indirectly to the XmlSchemaSet because they were imported.


The Schemas method is the equivalent of the Item method of the obsolete XmlSchemaCollection.

The following example illustrates how to iterate over all the schemas in the namespace in the XmlSchemaSet.

XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add("", "");

foreach (XmlSchema schema in schemaSet.Schemas(""))

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0