From 8e4925a8b0557413245a2c3fe77958b0beb11986 Mon Sep 17 00:00:00 2001 From: Jaap Brasser Date: Fri, 9 Aug 2019 17:07:31 +0200 Subject: [PATCH] Replace if with switch --- .../ConvertTo-Base64GUIExample.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ConvertTo-Base64GUIExample/ConvertTo-Base64GUIExample.ps1 b/ConvertTo-Base64GUIExample/ConvertTo-Base64GUIExample.ps1 index 4d31b4a..5ba59b7 100644 --- a/ConvertTo-Base64GUIExample/ConvertTo-Base64GUIExample.ps1 +++ b/ConvertTo-Base64GUIExample/ConvertTo-Base64GUIExample.ps1 @@ -13,10 +13,14 @@ param( [string] $GUIType = 'VB' ) - if ('VB' -eq $GUIType) { - [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null - [Microsoft.VisualBasic.Interaction]::InputBox("Let's convert this to base64", $Title, $null) | ForEach-Object { - [Microsoft.VisualBasic.Interaction]::MsgBox([convert]::ToBase64String([char[]]$_),0,$Title) + switch ($GUIType) { + 'VB' { + [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null + [Microsoft.VisualBasic.Interaction]::InputBox("Let's convert this to base64", $Title, $null) | ForEach-Object { + [Microsoft.VisualBasic.Interaction]::MsgBox([convert]::ToBase64String([char[]]$_),0,$Title) + } + } + default { } } } \ No newline at end of file