Question [Tutoriel] Usage des classes génériques avec Powershell

Plus d'informations
il y a 2 ans 5 mois #31442 par Laurent Dardenne
Le tutoriel

Table des matières :

1    UN TYPE A PART    3
2    CLASSE GENERIQUE    5
2.1    RETROUVER LES CLASSES GENERIQUES DISPONIBLES    7
3    NOM DE TYPE D’UNE CLASSE GENERIQUE    8
3.1    DIFFERENCE ENTRE TYPE ET RUNTIMETYPE    8
3.2    CREER UN RUNTIMETYPE    8
3.3    CREER UNE INSTANCE    9
3.4    AFFICHAGE D’UN NOM DE TYPE    10
3.4.1    Type générique fermé    11
3.4.2    Type générique ouvert    12
3.4.3    Le champ AssemblyQualifiedName    14
4    TYPER LES PARAMETRES    15
4.1.1    Opérateur +=    15
5    DELEGUE GENERIQUE    16
5.1    A PROPOS DE L’INFERENCE DE TYPE    17
5.2    RECONNAITRE L’USAGE D’UN DELEGUE    18
5.3    RETROUVER LES DELEGUES DISPONIBLES    19
5.3.1    System.Action : Action<T>    20
5.3.2    System.Func : Funct<T,TResult>    23
5.3.3    System.Predicate : Predicate<T>    25
5.4    EXEMPLE D’USAGE DE DELEGUE AVEC PSREADLINE    25
5.5    EXEMPLES AVANCES    26
5.5.1    System.Action avec une méthode d’instance avec Powershell 5.1    26
5.5.2    System.Action avec une méthode d’instance avec Powershell 7.0    26
5.6    LES METHODES MAGIQUE FOREACH() ET WHERE()    27
6    METHODE GENERIQUE    27
6.1    INFERENCE    29
6.2    MAKEGENERICMETHOD    31
6.2.1    La méthode Invoke() et l’usage de la virgule (comma operator)    32
7    CLASSE GENERIQUE CONTRAINTE    34
7.1    METHODE CONTRAINTE    35
8    ETS ET LES GENERIQUES    36
8.1    CREER UN RACCOURCI DE TYPE AVEC UN GENERIQUE    37
9    A PROPOS DE LINQ    38
9.1    METHODE D’EXTENSION    38
9.2    INTERFACE    40
9.2.1    L’Interface IEnumerable    40
9.2.2    L’Interface IEnumerable<T>    40
9.3    LINQ ET LES COLLECTIONS CLASSIQUES    41
9.3.1    Array et IEnumerable<T>    41
9.3.1    Propriété Count    41
9.3.2    DataTable    42
9.4    EXECUTION DIFFEREE    43

 

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 ans 4 mois #31480 par Laurent Dardenne
Une autre implémentation de LINQ avec Powershell :
github.com/ironmansoftware/plinq

Demande qq compétences en C# , ne serait-ce que pour compiler l'exemple.
Pour le moment ne sont disponible que les opérateurs qu'il a encapsulé, de mon côté je pensais enrichir ce code afin de prendre en charge les méthodes d'extension générique...

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 ans 1 mois - il y a 5 mois 3 semaines #31734 par Laurent Dardenne
Un prochain ajout : Add support for supplying generic method type parameters :
# static generic methods
[type_name]::MethodName[generic_type_arguments](method_arguments)

# instance generic methods
$object.MethodName[generic_type_arguments](method_arguments)

learn.microsoft.com/en-us/powershell/mod...?view=powershell-7.3

Tutoriels PowerShell
Dernière édition: il y a 5 mois 3 semaines par Laurent Dardenne. Raison: add url

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
Temps de génération de la page : 0.074 secondes
Propulsé par Kunena