문제

I have the following code that I'm translating from powershell to vb.net

for ($a=1; $a -le $intPasswordLength; $a++)
    {
        if ($a -gt 3)
        {
            $b = $rand.next(0,3) + $a
            $b = $b % 3 + 1
        } else { $b = $a }
        switch ($b)
        {
            "1" {$b = "$strNumbers"}
            "2" {$b = "$strCapitalLetters"}
            "3" {$b = "$strLowerLetters"}
        }
        $charset = $($b)
        $number = $rand.next(0,$charset.Length)
        $RandomPassword += $charset[$number]
    }
    $RandomPassword
}

The variable $RandomPassword is being declared and increased at the same time if I understand correctly, by the value $charset[$number]

what would be the equivalent on vb.net? how could I declare this and increase it by the value charset(number) on vb.net?

Thanks!

도움이 되었습니까?

해결책

This is just string concatentation and += works for that in VB as well:

Dim s As String = "foo"
s += " bar"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top