GenericIdentity Constructeurs
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise une nouvelle instance de la classe GenericIdentity.
Surcharges
| Nom | Description |
|---|---|
| GenericIdentity(GenericIdentity) |
Initialise une nouvelle instance de la GenericIdentity classe à l’aide de l’objet spécifié GenericIdentity . |
| GenericIdentity(String) |
Initialise une nouvelle instance de la GenericIdentity classe représentant l’utilisateur avec le nom spécifié. |
| GenericIdentity(String, String) |
Initialise une nouvelle instance de la GenericIdentity classe représentant l’utilisateur avec le nom et le type d’authentification spécifiés. |
GenericIdentity(GenericIdentity)
Initialise une nouvelle instance de la GenericIdentity classe à l’aide de l’objet spécifié 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)
Paramètres
- identity
- GenericIdentity
Objet à partir duquel construire la nouvelle instance de GenericIdentity.
S’applique à
GenericIdentity(String)
Initialise une nouvelle instance de la GenericIdentity classe représentant l’utilisateur avec le nom spécifié.
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)
Paramètres
- name
- String
Nom de l’utilisateur dont le code est en cours d’exécution.
Exceptions
Le name paramètre est null.
Exemples
Le code suivant montre l’utilisation du GenericIdentity constructeur. Cet exemple de code fait partie d’un exemple plus grand fourni pour la GenericIdentity classe.
GenericIdentity^ defaultIdentity = gcnew GenericIdentity( "DefaultUser" );
GenericIdentity defaultIdentity = new GenericIdentity("DefaultUser");
Dim defaultIdentity As New GenericIdentity("DefaultUser")
S’applique à
GenericIdentity(String, String)
Initialise une nouvelle instance de la GenericIdentity classe représentant l’utilisateur avec le nom et le type d’authentification spécifiés.
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)
Paramètres
- name
- String
Nom de l’utilisateur dont le code est en cours d’exécution.
- type
- String
Type d’authentification utilisé pour identifier l’utilisateur.
Exceptions
Exemples
Le code suivant montre l’utilisation du GenericIdentity constructeur. Cet exemple de code fait partie d’un exemple plus grand fourni pour la GenericIdentity classe.
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)