diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index 6833fa0e61c..3ab4c3fb8d7 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -1,7 +1,7 @@ --- description: Describes how to define constructors for PowerShell classes. Locale: en-US -ms.date: 11/13/2023 +ms.date: 10/22/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_classes_constructors?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Classes_Constructors @@ -393,8 +393,11 @@ For classes that don't inherit from another class, the ordering is: For derived classes that inherit from another class, the ordering is: -1. The static constructor for the base class. -1. The static constructor for the derived class. +1. If the static constructor of the derived class doesn't depend on the base + class, the static constructor of the derived class is called first. +1. If the static constructor of the derived class depends on the base class, + the static constructor of the base class is called before executing the line + of code in the derived class that depends on base. 1. If the derived class constructor explicitly calls a base constructor overload, it runs that constructor for the base class. If it doesn't explicitly call a base constructor, it runs the default constructor for the diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index 6ef41ffa916..140c94c3d20 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -1,7 +1,7 @@ --- description: Describes how to define constructors for PowerShell classes. Locale: en-US -ms.date: 10/13/2025 +ms.date: 10/22/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_classes_constructors?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Classes_Constructors @@ -392,8 +392,11 @@ For classes that don't inherit from another class, the ordering is: For derived classes that inherit from another class, the ordering is: -1. The static constructor for the base class. -1. The static constructor for the derived class. +1. If the static constructor of the derived class doesn't depend on the base + class, the static constructor of the derived class is called first. +1. If the static constructor of the derived class depends on the base class, + the static constructor of the base class is called before executing the line + of code in the derived class that depends on base. 1. If the derived class constructor explicitly calls a base constructor overload, it runs that constructor for the base class. If it doesn't explicitly call a base constructor, it runs the default constructor for the diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index 7d2594702ab..420f4dc6bdd 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -1,7 +1,7 @@ --- description: Describes how to define constructors for PowerShell classes. Locale: en-US -ms.date: 10/13/2025 +ms.date: 10/22/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_classes_constructors?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Classes_Constructors @@ -392,8 +392,11 @@ For classes that don't inherit from another class, the ordering is: For derived classes that inherit from another class, the ordering is: -1. The static constructor for the base class. -1. The static constructor for the derived class. +1. If the static constructor of the derived class doesn't depend on the base + class, the static constructor of the derived class is called first. +1. If the static constructor of the derived class depends on the base class, + the static constructor of the base class is called before executing the line + of code in the derived class that depends on base. 1. If the derived class constructor explicitly calls a base constructor overload, it runs that constructor for the base class. If it doesn't explicitly call a base constructor, it runs the default constructor for the diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index d15dc0bdf9f..6ae26971fc8 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -1,7 +1,7 @@ --- description: Describes how to define constructors for PowerShell classes. Locale: en-US -ms.date: 10/13/2025 +ms.date: 10/22/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_classes_constructors?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Classes_Constructors @@ -392,8 +392,11 @@ For classes that don't inherit from another class, the ordering is: For derived classes that inherit from another class, the ordering is: -1. The static constructor for the base class. -1. The static constructor for the derived class. +1. If the static constructor of the derived class doesn't depend on the base + class, the static constructor of the derived class is called first. +1. If the static constructor of the derived class depends on the base class, + the static constructor of the base class is called before executing the line + of code in the derived class that depends on base. 1. If the derived class constructor explicitly calls a base constructor overload, it runs that constructor for the base class. If it doesn't explicitly call a base constructor, it runs the default constructor for the