Export (0) Print
Expand All

Using Keywords as Identifiers

Visual Studio 2005

Visual J# allows @keyword to be treated as an identifier to allow the consumption of identifiers in referenced assemblies that are keywords reserved by Visual J#.

// vjc_identifier_1.cs
// compile with: /target:library
// C# program
public class MyClass1
{
   public static int synchronized = 0;   // valid in C#
}
// vjc_identifier_2.jsl
// compile with: /reference:vjc_identifier_1.dll
public class MyClass2
{
    public static void main(String [] args)
    {
        MyClass1 x = new MyClass1();
        // System.Console.WriteLine(x.synchronized);   // error
        System.Console.WriteLine(x.@synchronized);   // OK
    }
}

Output

0

Community Additions

ADD
Show:
© 2015 Microsoft