D
David VB2005
Guest
Hello,
I am trying to use some C# code in my VB.NET project, and used a converter to port over a class, and the conversion went well. But in one part I am getting a syntax error on the keyword 'New' hoping someone can assist in getting the code converted correctly.
Here's the C# code:
private static void DemandWebPermission(Uri uri)
{
string uriString = UriToString(uri);
if (uri.IsFile)
{
string localPath = uri.LocalPath;
new FileIOPermission(FileIOPermissionAccess.Read, localPath).Demand();
}
else
{
new WebPermission(NetworkAccess.Connect, uriString).Demand();
}
}
And here's the conversion where the keywords 'New' are marked as having BC0035 Syntax errors:
Private Shared Sub DemandWebPermission(ByVal uri As Uri)
Dim uriString As String = UriToString(uri)
If uri.IsFile Then
Dim localPath As String = uri.LocalPath
New FileIOPermission(FileIOPermissionAccess.Read, localPath).Demand()
Else
New WebPermission(NetworkAccess.Connect, uriString).Demand()
End If
End Sub
Continue reading...
I am trying to use some C# code in my VB.NET project, and used a converter to port over a class, and the conversion went well. But in one part I am getting a syntax error on the keyword 'New' hoping someone can assist in getting the code converted correctly.
Here's the C# code:
private static void DemandWebPermission(Uri uri)
{
string uriString = UriToString(uri);
if (uri.IsFile)
{
string localPath = uri.LocalPath;
new FileIOPermission(FileIOPermissionAccess.Read, localPath).Demand();
}
else
{
new WebPermission(NetworkAccess.Connect, uriString).Demand();
}
}
And here's the conversion where the keywords 'New' are marked as having BC0035 Syntax errors:
Private Shared Sub DemandWebPermission(ByVal uri As Uri)
Dim uriString As String = UriToString(uri)
If uri.IsFile Then
Dim localPath As String = uri.LocalPath
New FileIOPermission(FileIOPermissionAccess.Read, localPath).Demand()
Else
New WebPermission(NetworkAccess.Connect, uriString).Demand()
End If
End Sub
Continue reading...