Skip to content

Commit

Permalink
docs: Format tables
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlydog committed Aug 17, 2023
1 parent dd2c56d commit b507415
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ The results of using the different methods to reference a PowerShell native clas

| | Class/Enum can be used by module functions | Class/Enum type can be used outside of module |
| -------------------------------------------- | ------------------------------------------ | --------------------------------------------- |
| Class/Enum file imported with `using module` |||
| Class/Enum file imported with Dot-sourcing | ✔️ ||
| Class/Enum defined in the psm1 file | ✔️ | ✔️ |
| Class/Enum file imported with `using module` | | |
| Class/Enum file imported with Dot-sourcing | ✔️ | |
| Class/Enum defined in the psm1 file | ✔️ | ✔️ |

If I use `using module` to import the file with the class, then the class cannot be used by the module functions, and the class type cannot be used outside of the module.
Simply put, it does not work at all.
Expand All @@ -90,8 +90,8 @@ The results below assume the class/enum is referenced directly in the psm1 file

| | Class/Enum can be used by module functions | Class/Enum type can be used outside of module |
| ------------------------------------ | ------------------------------------------ | --------------------------------------------- |
| Module imported with `Import-Module` | ✔️ ||
| Module imported with `using module` | ✔️ | ✔️ |
| Module imported with `Import-Module` | ✔️ | |
| Module imported with `using module` | ✔️ | ✔️ |

If you use `Import-Module` to import the module, you can use the class/enum values implicitly, and autocomplete will work.
By implicitly, I mean that you can retrieve a class/enum instance from a module function, pass the instance around, modify the class properties, and pass it back into module function parameters.
Expand Down Expand Up @@ -131,15 +131,15 @@ Using namespaces can help avoid naming conflicts for common class names.
Using C# classes and enums as shown above instead of the PowerShell native class/enum, the results are as follows:

| | C# Class/Enum can be used by module functions | C# Class/Enum type can be used outside of module |
| -------------------------------------------- | ------------------------------------------ | --------------------------------------------- |
| Class/Enum file imported with `using module` | ✔️ | ✔️ |
| Class/Enum file imported with Dot-sourcing | ✔️ | ✔️ |
| Class/Enum defined in the psm1 file | ✔️ | ✔️ |
| -------------------------------------------- | --------------------------------------------- | ------------------------------------------------ |
| Class/Enum file imported with `using module` | ✔️ | ✔️ |
| Class/Enum file imported with Dot-sourcing | ✔️ | ✔️ |
| Class/Enum defined in the psm1 file | ✔️ | ✔️ |

| | C# Class/Enum can be used by module functions | C# Class/Enum type can be used outside of module |
| ------------------------------------ | ------------------------------------------ | --------------------------------------------- |
| Module imported with `Import-Module` | ✔️ | ✔️ |
| Module imported with `using module` | ✔️ | ✔️ |
| ------------------------------------ | --------------------------------------------- | ------------------------------------------------ |
| Module imported with `Import-Module` | ✔️ | ✔️ |
| Module imported with `using module` | ✔️ | ✔️ |

You can see that using C# classes/enums is much more flexible than using the PowerShell native classes/enums.
They allow us to define the classes/enums in their own files, and allow end-users to use `Import-Module` and still have full access to the class/enum types.
Expand Down

0 comments on commit b507415

Please sign in to comment.