views:

151

answers:

3

I am converting C# code to VB.Net and the C code has this above the function:

[return: System.Xml.Serialization.XmlElementAttribute("Name", IsNullable=true)]
A: 

I haven't really worked much with VB, but for a subroutine, I think to need to put a variable which is the same name as the subroutine.

But since you say VB .NET, doesn't the regular 'Return' keyword do something?

http://msdn.microsoft.com/en-us/library/2e34641s.aspx

If that is not the case, I'm not sure what exact problem you are facing. It's be helpful if you could provide more information.

Rohan Prabhu
A: 

Given this C# code:

public [return:XmlElement("Name", IsNullable=true)] string Foo()
{
    return "";
}

will translate to something like:

Public Function Foo() As <XmlElement("Name", IsNullable := True)> String
    Return ""
End Function
Anton Gogolev
A: 

IN VB.Net simply put it just before the type in the As clause

Public Function Example() As <XmlElementAttribute("Name", IsNullable:=true)> As SomeType
  ...
End FUnction
JaredPar