Search code examples
c#vb.netportingcode-translation

Unable to identify some C# syntax for translation to VB.NET


I'm translating some example code line by line from C# to VB.NET.

The lines which confuse me looks like this:

[Kernel(CustomFallbackMethod = "AddCpu")] 

I see in the code that these lines appear just before the method declaration:

private static void

What kind of line appears before a method declaration? Or is it a continuation of the last? I hope this is obvious to a native C Sharper.


Solution

  • It's an Attribute. It's a way to mark up code that can be used at runtime or compile time.

    I would google VB.NET and Attributes. You can read some passages here on O'Reilly

    Your example would be converted to:

           <Kernel(CustomFallbackMethod:="AddCpu")>
    

    Be sure to use _ if you decide to put it on the line before your method.