IdentityReferenceCollection.Translate 方法

定义

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

重载

Translate(Type)

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

Translate(Type, Boolean)

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

Translate(Type)

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

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

一个 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

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

如果 forceSuccesstrue,则由于未能为转换找到映射而发生的转换错误会导致转换失败并引发异常。

如果 forceSuccessfalse,则因未为转换找到映射而未能转换的类型会在不进行转换的情况下被复制到返回的集合中。

返回

IdentityReferenceCollection

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

注解

顺序在返回的集合中保留,也就是说,返回的集合中的第一项对应于源集合中的第一项,等等。

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

适用于