Share via


GenericIdentity コンストラクター

定義

GenericIdentity クラスの新しいインスタンスを初期化します。

オーバーロード

GenericIdentity(GenericIdentity)

指定した GenericIdentity オブジェクトを使用して、GenericIdentity クラスの新しいインスタンスを初期化します。

GenericIdentity(String)

指定した名前のユーザーを表す GenericIdentity クラスの新しいインスタンスを初期化します。

GenericIdentity(String, String)

名前および認証の種類を指定して、ユーザーを表す GenericIdentity クラスの新しいインスタンスを初期化します。

GenericIdentity(GenericIdentity)

指定した GenericIdentity オブジェクトを使用して、GenericIdentity クラスの新しいインスタンスを初期化します。

protected:
 GenericIdentity(System::Security::Principal::GenericIdentity ^ identity);
protected GenericIdentity (System.Security.Principal.GenericIdentity identity);
new System.Security.Principal.GenericIdentity : System.Security.Principal.GenericIdentity -> System.Security.Principal.GenericIdentity
Protected Sub New (identity As GenericIdentity)

パラメーター

identity
GenericIdentity

GenericIdentity の新しいインスタンスの生成元となるオブジェクト。

適用対象

GenericIdentity(String)

指定した名前のユーザーを表す GenericIdentity クラスの新しいインスタンスを初期化します。

public:
 GenericIdentity(System::String ^ name);
public GenericIdentity (string name);
new System.Security.Principal.GenericIdentity : string -> System.Security.Principal.GenericIdentity
Public Sub New (name As String)

パラメーター

name
String

コードが実行されている対象ユーザーの名前。

例外

name パラメーターが null です。

次のコードは、コンストラクターの使用方法を GenericIdentity 示しています。 このコード例は、GenericIdentity クラスのために提供されている大規模な例の一部です。

GenericIdentity^ defaultIdentity = gcnew GenericIdentity( "DefaultUser" );
GenericIdentity defaultIdentity = new GenericIdentity("DefaultUser");
Dim defaultIdentity As New GenericIdentity("DefaultUser")

適用対象

GenericIdentity(String, String)

名前および認証の種類を指定して、ユーザーを表す GenericIdentity クラスの新しいインスタンスを初期化します。

public:
 GenericIdentity(System::String ^ name, System::String ^ type);
public GenericIdentity (string name, string type);
new System.Security.Principal.GenericIdentity : string * string -> System.Security.Principal.GenericIdentity
Public Sub New (name As String, type As String)

パラメーター

name
String

コードが実行されている対象ユーザーの名前。

type
String

ユーザーを識別するために使用する認証の種類。

例外

name パラメーターが null です。

または type パラメーターが null です。

次のコードは、コンストラクターの使用方法を GenericIdentity 示しています。 このコード例は、GenericIdentity クラスのために提供されている大規模な例の一部です。

WindowsIdentity^ windowsIdentity = WindowsIdentity::GetCurrent();

// Construct a GenericIdentity object based on the current Windows
// identity name and authentication type.
String^ authenticationType = windowsIdentity->AuthenticationType;
String^ userName = windowsIdentity->Name;
GenericIdentity^ authenticatedGenericIdentity = gcnew GenericIdentity( userName,authenticationType );
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();

// Construct a GenericIdentity object based on the current Windows
// identity name and authentication type.
string authenticationType = windowsIdentity.AuthenticationType;
string userName = windowsIdentity.Name;
GenericIdentity authenticatedGenericIdentity =
    new GenericIdentity(userName, authenticationType);
Dim windowsIdentity As WindowsIdentity = windowsIdentity.GetCurrent()

' Construct a GenericIdentity object based on the current Windows
' identity name and authentication type.
Dim authenticationType As String = windowsIdentity.AuthenticationType
Dim userName As String = windowsIdentity.Name
Dim authenticatedGenericIdentity As _
    New GenericIdentity(userName, authenticationType)

適用対象