XsdDataContractImporter.Import 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将一组 XML 架构转换为用于生成 CLR 代码的 CodeCompileUnit。
重载
| Import(XmlSchemaSet) | 
						 将 XmlSchemaSet 中包含的一组指定 XML 架构转换为 CodeCompileUnit。  | 
        	
| Import(XmlSchemaSet, ICollection<XmlQualifiedName>) | 
						 将 XmlSchemaSet 中包含的一组指定架构类型转换为生成到 CodeCompileUnit 中的 CLR 类型。  | 
        	
| Import(XmlSchemaSet, XmlSchemaElement) | 
						 将指定的 XML 架构集中的指定架构元素转换为 CodeCompileUnit,并返回用于表示指定元素的数据协定名称的 XmlQualifiedName。  | 
        	
| Import(XmlSchemaSet, XmlQualifiedName) | 
						 将 XmlSchemaSet 中包含的指定 XML 架构类型转换为 CodeCompileUnit。  | 
        	
Import(XmlSchemaSet)
- Source:
 - XsdDataContractImporter.cs
 
- Source:
 - XsdDataContractImporter.cs
 
将 XmlSchemaSet 中包含的一组指定 XML 架构转换为 CodeCompileUnit。
public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas);
	public void Import (System.Xml.Schema.XmlSchemaSet schemas);
	member this.Import : System.Xml.Schema.XmlSchemaSet -> unit
	Public Sub Import (schemas As XmlSchemaSet)
	参数
- schemas
 - XmlSchemaSet
 
一个 XmlSchemaSet,它包含要为其生成 CLR 类型的架构表示。
例外
              schemas 参数为 null。
示例
下面的示例使用 CanImport 方法测试是否可以导入一组架构。 如果 CanImport 方法返回 true,则这些代码会调用 Import 方法。
static CodeCompileUnit Import(XmlSchemaSet schemas)
{
    XsdDataContractImporter imp = new XsdDataContractImporter();
    // The EnableDataBinding option adds a RaisePropertyChanged method to
    // the generated code. The GenerateInternal causes code access to be
    // set to internal.
    ImportOptions iOptions = new ImportOptions();
    iOptions.EnableDataBinding = true;
    iOptions.GenerateInternal = true;
    imp.Options = iOptions;
    if (imp.CanImport(schemas))
    {
        imp.Import(schemas);
        return imp.CodeCompileUnit;
    }
    else
    {
        return null;
    }
}
Shared Function Import(ByVal schemas As XmlSchemaSet) As CodeCompileUnit 
    Dim imp As New XsdDataContractImporter()
   ' The EnableDataBinding option adds a RaisePropertyChanged method to
   ' the generated code. The GenerateInternal causes code access to be
   ' set to internal.
   Dim iOptions As New ImportOptions()
   iOptions.EnableDataBinding = true
   iOptions.GenerateInternal = true
   imp.Options = IOptions
    If imp.CanImport(schemas) Then
        imp.Import(schemas)
        Return imp.CodeCompileUnit
    Else
        Return Nothing
    End If
End Function
  适用于
Import(XmlSchemaSet, ICollection<XmlQualifiedName>)
- Source:
 - XsdDataContractImporter.cs
 
- Source:
 - XsdDataContractImporter.cs
 
将 XmlSchemaSet 中包含的一组指定架构类型转换为生成到 CodeCompileUnit 中的 CLR 类型。
public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Collections::Generic::ICollection<System::Xml::XmlQualifiedName ^> ^ typeNames);
	public void Import (System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> typeNames);
	member this.Import : System.Xml.Schema.XmlSchemaSet * System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> -> unit
	Public Sub Import (schemas As XmlSchemaSet, typeNames As ICollection(Of XmlQualifiedName))
	参数
- schemas
 - XmlSchemaSet
 
一个 XmlSchemaSet,它包含架构表示。
- typeNames
 - ICollection<XmlQualifiedName>
 
表示要导入的一组架构类型的类型为 XmlQualifiedName 的 ICollection<T>。
适用于
Import(XmlSchemaSet, XmlSchemaElement)
- Source:
 - XsdDataContractImporter.cs
 
- Source:
 - XsdDataContractImporter.cs
 
将指定的 XML 架构集中的指定架构元素转换为 CodeCompileUnit,并返回用于表示指定元素的数据协定名称的 XmlQualifiedName。
public:
 System::Xml::XmlQualifiedName ^ Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::Schema::XmlSchemaElement ^ element);
	public System.Xml.XmlQualifiedName? Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element);
	public System.Xml.XmlQualifiedName Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element);
	member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.Schema.XmlSchemaElement -> System.Xml.XmlQualifiedName
	Public Function Import (schemas As XmlSchemaSet, element As XmlSchemaElement) As XmlQualifiedName
	参数
- schemas
 - XmlSchemaSet
 
一个 XmlSchemaSet,它包含要转换的架构。
- element
 - XmlSchemaElement
 
一个 XmlSchemaElement,它表示要转换的特定架构元素。
返回
一个 XmlQualifiedName,它表示指定的元素。
例外
              schemas 或 element 参数为 null。
适用于
Import(XmlSchemaSet, XmlQualifiedName)
- Source:
 - XsdDataContractImporter.cs
 
- Source:
 - XsdDataContractImporter.cs
 
将 XmlSchemaSet 中包含的指定 XML 架构类型转换为 CodeCompileUnit。
public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::XmlQualifiedName ^ typeName);
	public void Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
	member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> unit
	Public Sub Import (schemas As XmlSchemaSet, typeName As XmlQualifiedName)
	参数
- schemas
 - XmlSchemaSet
 
一个 XmlSchemaSet,它包含架构表示。
- typeName
 - XmlQualifiedName
 
一个 XmlQualifiedName,它表示要导入的特定架构类型。
例外
              schemas 或 typeName 参数为 null。