Open chriskuech opened 4 years ago
Hi @chriskuech Be carefull, as that would expose all your classes to the end user, and they could end up polluting his session. It is possible to export classes by using a 'hybrid approach'. When you boil it down to the bare minimum, it is nothing more than wrapping the instantiation of a class in a function starting with the 'new-' keyword. Example, if you have a class called CustomRequirement you can do this.
Function New-CustomRequirement {
Param(
)
return [CustomRequirement]::New() #possible to work with overloaded constructors and parameter sets.
}
We heavily rely on classes, which don't integrate well with
Import-Module
, which forces us to dot source a lot.using module
should solve our import woes.