Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

class ignores if/while bug?

$
0
0

Hi

Something strange I encountered 

if you put a class in a while/if that will not run it will get created?!

if ($false)
{
    'How is this class get created if this line does not?'
    class Base64
    {
        [string]$ItemName

        Base64([string]$String)
        {
            $this.ItemName = $String
        }

        [string]ToString()
        {
            return $this.ItemName
        }
    }
}
[base64]$a = 'aaaa'
$a

How?

Why?



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>