C# to VB : internal

  • Thread starter Thread starter stuart
  • Start date Start date
S

stuart

Hi,

I am trying to convert a C# class that produces a "self describing menu" in
a console app.

the c# project defines the following class

internal class MenuAttribute : Attribute
{
public int MenuKey = 0;
public string MenuCaption = string.Empty;

public MenuAttribute( int k, string c )
{
MenuKey = k;
MenuCaption = c;
}
}

however there does not appear to be an equivalent of the internal keyword in
VB.
also the c# project then goes on to describe menu Items as

[MenuAttribute(6, "Test Sequence Controller Process Begin")]
private static void TestProcessBegin()
{
eMailExpress.Business.SequenceController.Begin();
}

Is there an equivalent of this syntax in vb.
I tried <menuattribte.... but the compiler did not like that.

any help is appreciated.

cheers

martin.
 
however there does not appear to be an equivalent of the internal keyword in
VB.

I believe "Friend" is the VB.NET equivalent of internal.
also the c# project then goes on to describe menu Items as

[MenuAttribute(6, "Test Sequence Controller Process Begin")]
private static void TestProcessBegin()
{
eMailExpress.Business.SequenceController.Begin();
}

Is there an equivalent of this syntax in vb.

<Menu(k:=6,s:="Test sequence Controller Process Begin")>

should work, I believe.
 
Hi jon,

cheers for the reply

it nearly works :)

I have replaced the C# function

[MenuAttribute(6, "Test Sequence Controller Process Begin")]
private static void TestProcessBegin()
{
Begin();
}

with a vb version

<Menu(k:=6, s:="Test sequence Controller Process Begin")> &_
Private Function Quit()
Console.WriteLine("Hello")
End Function

but the compiler does not like the line continuation character &_, so I
removed it and then I get a different error saying the statement is
incomplete

also I don't understand why the class is defined as

Friend Class MenuAttribute

but when I reference it that I have to use "Menu" and not "MenuAttribute"

thanks for your help.

cheers

martin.




Jon Skeet said:
however there does not appear to be an equivalent of the internal keyword in
VB.

I believe "Friend" is the VB.NET equivalent of internal.
also the c# project then goes on to describe menu Items as

[MenuAttribute(6, "Test Sequence Controller Process Begin")]
private static void TestProcessBegin()
{
eMailExpress.Business.SequenceController.Begin();
}

Is there an equivalent of this syntax in vb.

<Menu(k:=6,s:="Test sequence Controller Process Begin")>

should work, I believe.
 
stuart said:
Hi jon,

cheers for the reply

it nearly works :)

I have replaced the C# function

[MenuAttribute(6, "Test Sequence Controller Process Begin")]
private static void TestProcessBegin()
{
Begin();
}

with a vb version

<Menu(k:=6, s:="Test sequence Controller Process Begin")> &_
Private Function Quit()
Console.WriteLine("Hello")
End Function

but the compiler does not like the line continuation character &_, so I
removed it and then I get a different error saying the statement is
incomplete

Don't use "&_" as the line continuation indicator. Use " _".
also I don't understand why the class is defined as

Friend Class MenuAttribute

but when I reference it that I have to use "Menu" and not "MenuAttribute"

It's convention that attribute class names should end in "Attribute".
The C# and VB.NET languages allow you to use the full name or to use the
name with the "Attribute" portion dropped as an abbreviation.
thanks for your help.

cheers

martin.





keyword in

I believe "Friend" is the VB.NET equivalent of internal.

also the c# project then goes on to describe menu Items as

[MenuAttribute(6, "Test Sequence Controller Process Begin")]
private static void TestProcessBegin()
{
eMailExpress.Business.SequenceController.Begin();
}

Is there an equivalent of this syntax in vb.

<Menu(k:=6,s:="Test sequence Controller Process Begin")>

should work, I believe.
 
Back
Top