XsdDataContractImporter.GetKnownTypeReferences(XmlQualifiedName) 方法

定义

返回一个 CodeTypeReference 对象列表,这些对象表示在为指定架构类型生成代码时生成的已知类型。Returns a list of CodeTypeReference objects that represents the known types generated when generating code for the specified schema type.

public:
 System::Collections::Generic::ICollection<System::CodeDom::CodeTypeReference ^> ^ GetKnownTypeReferences(System::Xml::XmlQualifiedName ^ typeName);
public System.Collections.Generic.ICollection<System.CodeDom.CodeTypeReference> GetKnownTypeReferences (System.Xml.XmlQualifiedName typeName);
member this.GetKnownTypeReferences : System.Xml.XmlQualifiedName -> System.Collections.Generic.ICollection<System.CodeDom.CodeTypeReference>
Public Function GetKnownTypeReferences (typeName As XmlQualifiedName) As ICollection(Of CodeTypeReference)

参数

typeName
XmlQualifiedName

一个 XmlQualifiedName,它表示要为其查找已知类型的架构类型。An XmlQualifiedName that represents the schema type to look up known types for.

返回

ICollection<CodeTypeReference>

一个 IList<T> 类型的 CodeTypeReferenceA IList<T> of type CodeTypeReference.

注解

在为架构类型生成 CLR 类型时,还会为存在于架构中的所有派生类型生成已知类型。When generating CLR types for schema types, known types are also generated for all derived types that are present in the schema. 在许多情况下,使用属性将这些已知类型添加到生成的代码中。In many cases, these known types are added using attributes to the generated code. (示例,请参阅 KnownTypeAttribute 类。(For example, see the KnownTypeAttribute class. ) 但是,对于顶级类型,需要有一种方法来返回所生成的已知类型集。) However, for the top-level type, there needs to be a way to return the set of known types generated. 此方法返回为特定架构类型生成的已知类型的 CodeTypeReferenceThis method returns the CodeTypeReference for known types that were generated for a specific schema type.

有关详细信息,请参阅 数据协定已知类型For more information, see Data Contract Known Types.

适用于

另请参阅