Last active
June 22, 2024 05:49
-
-
Save refactorsaurusrex/9aa6b72f3519dbc71f7d0497df00eeb1 to your computer and use it in GitHub Desktop.
Revisions
-
refactorsaurusrex revised this gist
Oct 16, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ $output = 'This is an output string' [System.IO.File]::AppendAllLines($path, $output) # Result: 'Cannot find an overload for "AppendAllLines" and the argument count: "2".' # However, if you cast the string to an array, the correct overload can be found: [System.IO.File]::AppendAllLines([string]$path, [string[]]$output) # Hooray! -
refactorsaurusrex revised this gist
Jul 5, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ $path = 'C:\text.txt' $output = 'This is an output string' # This works... [System.IO.File]::WriteAllLines($path, $output) @@ -9,4 +9,6 @@ $output = "This is an output string" # Result: 'Cannot find an overload for "AppendAllLines" and the argument count: "2".' # However, if your parameters are strongly typed, the method will resolve correctly: [System.IO.File]::AppendAllLines([string]$path, [string[]]$output) # Hooray! -
refactorsaurusrex created this gist
Jul 5, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ $path = 'C:\text.txt' $output = "This is an output string" # This works... [System.IO.File]::WriteAllLines($path, $output) # But this doesn't. WTF! [System.IO.File]::AppendAllLines($path, $output) # Result: 'Cannot find an overload for "AppendAllLines" and the argument count: "2".' # However, if your parameters are strongly typed, the method will resolve correctly: [System.IO.File]::AppendAllLines([string]$path, [string[]]$output)