I have problems in converting the following code-snippet from C# to VB.Net:
if ((currentItem.Tag as FileSystemKind?) != FileSystemKind.File)
{
if (currentFileName == GOBACK)
currentPath = currentPath.Substring(0, currentPath.Length - Path.GetFileName(currentPath).Length - 1);
else
currentPath = Path.Combine(currentPath, currentFileName);
UpdateControls();
}
else
{
//If it's a file, we should return the selected filename
fileName = Path.Combine(currentPath, currentFileName);
EndOk();
}
The problem lies in the following line:
if ((currentItem.Tag as FileSystemKind?) != FileSystemKind.File)
I have tried two different online-converters which suggested me the following conversions (for above line):
1st one:
If (TryCast(currentItem.Tag, FileSystemKind)?) <> FileSystemKind.File Then
2nd one:
If TryCast(currentItem.Tag, System.Nullable(Of FileSystemKind)) <> FileSystemKind.File Then
The error I get in VB.Net is:
TryCast' operand must be reference type, but 'FileSystemKind?' is a value type.
The code is from a project targeting the Net.Compact Framework 2.0 but I think most should be compatible with the ordinary Compact Framework.
I am lost. Anyone who can help me out?
PS: I am sorry for the layout of the code in the question. Is there a way to change the font size to a smaller one?
Thanks!