Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- From: "Stephany Young" <noone@localhost>
- Date: Tue, 20 Feb 2007 10:36:18 +1300
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_newsgroups" <rowe_email@xxxxxxxxx> wrote in message news:1171910112.942649.72970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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...@xxxxxx> wrote:
"Stephany Young" <noone@localhost> schrieb:
> 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.
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/>
.
- Follow-Ups:
- Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- From: rowe_newsgroups
- Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- References:
- Adding C#-Code to VB-Project in VS 2005 without using DLL
- From: Sven Rutten
- Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- From: Stephany Young
- Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- From: Herfried K. Wagner [MVP]
- Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- From: rowe_newsgroups
- Adding C#-Code to VB-Project in VS 2005 without using DLL
- Prev by Date: Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- Next by Date: Re: FTPWebRequest and CD
- Previous by thread: Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- Next by thread: Re: Adding C#-Code to VB-Project in VS 2005 without using DLL
- Index(es):
Relevant Pages
|