CodeGenerationOptions 枚举

定义

指定在生成用于 XML Web services 的 .NET 类型时使用的各种选项。

此枚举支持其成员值的按位组合。

[System.Flags]
public enum CodeGenerationOptions
继承
CodeGenerationOptions
属性

字段

名称 说明
EnableDataBinding 16

启用数据绑定。

GenerateNewAsync 2

创建异步调用 Web 方法的事件。

GenerateOldAsync 4

创建异步调用 Web 方法的 Begin 和 End 方法。

GenerateOrder 8

XmlAnyElementAttributeXmlArrayAttributeXmlElementAttribute 特性的 Order 属性所指定的方式显式生成排序序列化代码。

GenerateProperties 1

由属性表示基元类型。

None 0

由字段表示基元类型并由 System 命名空间类型表示基元类型。

示例

下面的示例演示如何使用 CodeGenerationOptions 枚举来指定 对象的行为 ServiceDescriptionImporter

// Generate properties to represent primitive values.
importer.CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateProperties;

注解

有关此 API 的详细信息,请参阅 CodeGenerationOptions 的补充 API 备注

适用于

产品 版本
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

另请参阅