语言

IdentityReferenceCollection.Translate 方法

定义

将集合中的 IdentityReferenceCollection 对象转换为指定类型。

重载

名称 说明
Translate(Type)

将集合中的对象转换为指定类型。 调用此方法与将第二个参数设置为 Translate(Type, Boolean) 的调用false相同,这意味着不会为失败转换的项引发异常。

Translate(Type, Boolean)

将集合中的对象转换为指定类型,并使用指定的容错来处理或忽略与没有转换映射的类型关联的错误。

Translate(Type)

将集合中的对象转换为指定类型。 调用此方法与将第二个参数设置为 Translate(Type, Boolean) 的调用false相同,这意味着不会为失败转换的项引发异常。

public:
 System::Security::Principal::IdentityReferenceCollection ^ Translate(Type ^ targetType);
public System.Security.Principal.IdentityReferenceCollection Translate(Type targetType);
member this.Translate : Type -> System.Security.Principal.IdentityReferenceCollection
Public Function Translate (targetType As Type) As IdentityReferenceCollection

参数

targetType
Type

将集合中的项转换为的类型。

返回

一个 IdentityReferenceCollection 集合,表示原始集合的转换内容。

注解

顺序在返回的集合中保留,也就是说,返回集合中的第一项对应于源集合中的第一项,依此表示集合中每个项。

源集合中的项不需要属于同一类型。

适用于

Translate(Type, Boolean)

将集合中的对象转换为指定类型,并使用指定的容错来处理或忽略与没有转换映射的类型关联的错误。

public:
 System::Security::Principal::IdentityReferenceCollection ^ Translate(Type ^ targetType, bool forceSuccess);
public System.Security.Principal.IdentityReferenceCollection Translate(Type targetType, bool forceSuccess);
member this.Translate : Type * bool -> System.Security.Principal.IdentityReferenceCollection
Public Function Translate (targetType As Type, forceSuccess As Boolean) As IdentityReferenceCollection

参数

targetType
Type

将集合中的项转换为的类型。

forceSuccess
Boolean

一个布尔值,用于确定如何处理转换错误。

forceSuccess如果是true,由于未为转换找到映射,转换错误会导致转换失败,并引发异常。

forceSuccess如果是false,由于找不到转换的映射而无法转换的类型将被复制,而不会被转换为要返回的集合。

返回

一个 IdentityReferenceCollection 集合,表示原始集合的转换内容。

注解

顺序在返回的集合中保留,也就是说,返回集合中的第一项对应于源集合中的第一项,依此表示集合中每个项。

源集合中的项不需要属于同一类型。

适用于