Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
Now there's a question and a half Seth :)
Have you finished the preprocessor yet? :)
How would you envisage it resolving something like:
#Visual Basic
Public Class Foo
#End Visual Basic
#Visual Basic
Public X As Integer
Public Sub VBFoo
x += 1
End Sub
#End Visual Basic
#CSharp
public int x;
public void CSharpFoo()
{
x++;
}
#CSharp
#Visual Basic
End Class
#End Visual Basic
In VB.NET, variable names are case-insensitive, so, logically the dummy
would be spat because VB.Net can;t handle 2 variables with the same name
having the same scope.
In C#, however, variable names are case-sensitive, so, X and x declared
having the same scope is perfectly legal.
The point here is that such a preprocessor, to be of any value would need to
break the rules of one language to allow the rules of the other language,
and, immediately, that need negates any value that such a preprocessor might
have.
"rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
news:1171910112 .942649.72970@p 10g2000cwp.goog legroups.com...
Now there's a question and a half Seth :)
Have you finished the preprocessor yet? :)
How would you envisage it resolving something like:
#Visual Basic
Public Class Foo
#End Visual Basic
#Visual Basic
Public X As Integer
Public Sub VBFoo
x += 1
End Sub
#End Visual Basic
#CSharp
public int x;
public void CSharpFoo()
{
x++;
}
#CSharp
#Visual Basic
End Class
#End Visual Basic
In VB.NET, variable names are case-insensitive, so, logically the dummy
would be spat because VB.Net can;t handle 2 variables with the same name
having the same scope.
In C#, however, variable names are case-sensitive, so, X and x declared
having the same scope is perfectly legal.
The point here is that such a preprocessor, to be of any value would need to
break the rules of one language to allow the rules of the other language,
and, immediately, that need negates any value that such a preprocessor might
have.
"rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
news:1171910112 .942649.72970@p 10g2000cwp.goog legroups.com...
>I know this is slightly off topic, but I'm curious - since both vb and
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?
>
Something like:
>
#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic
>
#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp
>
Thanks,
>
Seth Rowe
>
>
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
>
>
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?
>
Something like:
>
#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic
>
#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp
>
Thanks,
>
Seth Rowe
>
>
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
>"Stephany Young" <noone@localhos tschrieb:
>>
>>
>You actually cannot, except in Web projects in which you can use
>different
>languages in different script blocks and pages.
>>
>--
> M S Herfried K. Wagner
>M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>>
Seeing as how you have learned that you can, since VS 2005, add C#-Code
to
a VB Project, would you please be so kind as to enlighten us. We would
be
most interested.
to
a VB Project, would you please be so kind as to enlighten us. We would
be
most interested.
>You actually cannot, except in Web projects in which you can use
>different
>languages in different script blocks and pages.
>>
>--
> M S Herfried K. Wagner
>M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>
Comment