Machine???

  • Thread starter Thread starter Lespaul36
  • Start date Start date
L

Lespaul36

I have some code from C# that I have converted to vb.net. I used a
converter for a lot of it. One piece is giving problems
Machine.Shift.Right

it says that it is not declared.

where is the machine class, or how else do I do this .



C# code:

public string MaskToLogicalPaths(int aMask)

{

int lMask = aMask;

int lValue = 0;

StringBuilder lReturn = new StringBuilder(128);

try

{

lReturn = new StringBuilder(128);

if(aMask>0)

{

for (;lMask!=0;lMask>>=1)

{

if ((lMask & 1)!=0)

{

lReturn.Append((char)(65+lValue));

lReturn.Append(":,");

}

lValue ++;

}

lReturn.Remove(lReturn.Length-1,1);

}

return lReturn.ToString();

}

finally

{

lReturn = null;

}

}



vb code:

Public Function MaskToLogicalPaths(ByVal aMask As Integer) As String

Dim lMask As Integer = aMask

Dim lValue As Integer = 0

Dim lReturn As New StringBuilder(128)

Try

lReturn = New StringBuilder(128)

If aMask > 0 Then

While lMask <> 0

If (lMask And 1) <> 0 Then

lReturn.Append(Microsoft.VisualBasic.ChrW(65 + lValue))

lReturn.Append(":,")

End If

lValue += 1

lMask = Machine.Shift.Right(lMask, 1)

End While

lReturn.Remove(lReturn.Length - 1, 1)

End If

Return lReturn.ToString()

Finally

lReturn = Nothing

End Try

End Function
 
Bit shifting is available with the << and >> operators in VB.NET. Look these
up in the help

Regards

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
Back
Top