Looking For Explanation Regarding Declaration Syntax

G

GhostInAK

Hello Brian,

I'm so used to working in one language I forget about the others sometimes.
Ah well. It's still a pet peeve, but I retract my earlier comment about
shooting someone. Bracketed keywords as identifiers is a small price to
pay for language interop.

-Boo
Chris said:
In this case, only VB keywords. You can use C# and C++ keywords in
VB as identifiers without any special syntax (other than those that
happen to match VB).
The problem is using VB.NET keywords in a class library written in
another language which you use in VB.NET. Consider the following
example.

// Compiled in C#
namespace Example
{
public class Foo
{
public static int New = 0;
}
}
' Compiled in VB.NET
Imports Example
Module Module1

Sub Main()
Console.WriteLine(Foo.New) ' Error
Console.WriteLine(Foo.[New]) ' Correct
End Sub
End Module
How is this done in C#?
C# uses the @ prefix.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top