Skip to content

JavaModifiers

Mehdi Mohammadi edited this page Dec 30, 2013 · 1 revision

Some Java modifiers have equivalent modifiers or attributes in C#. Here there are:

Java keyword   .Net keyword / attrbute
-------------- -----------------------------------------------------
final          sealed
transient      System.NonSerialized||
synchronized   MethodImplAttribute(MethodImplOptions.Synchronized)

[Java]

public final class Test
{
    public transient String name;
    public synchronized void Method()
    {
    }
}

[C#]

public sealed class Test
{
    [System.NonSerializedAttribute()]
    public String name;

    [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.Synchronized)]
    public void Method()
    {
    }
}
Clone this wiki locally