Adding C#-Code to VB-Project in VS 2005 without using DLL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephany Young

    #16
    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...
    >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:
    >"Stephany Young" <noone@localhos tschrieb:
    >>
    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/>
    >
    >

    Comment

    • rowe_newsgroups

      #17
      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? :)
      Finished? I haven't even started! (and probably won't)

      :-)
      How would you envisage it resolving something like:
      <snip>

      Good point Stephany, I didn't really think it through - it was just a
      thought that I had while reading this thread. Perhaps a class level
      attribute that declares the entire class contents in a certain
      language would resolve these issues, but that kind of defeats the
      purpose (not to mention the "coolness" factor) doesn't it?.

      By the way, how exactly would one find how to go about writing
      something like this? Also, unless you rewrite the ide you would
      probably lose intellisense and many other special features/keywords,
      not to mention the error checking.

      Thanks,

      Seth Rowe


      On Feb 19, 4:36 pm, "Stephany Young" <noone@localhos twrote:
      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_em...@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:
      "Stephany Young" <noone@localhos tschrieb:
      >
      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/>

      Comment

      • aaron.kempf@gmail.com

        #18
        Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

        I just reccomend using Dreamweaver; and a single language

        Avoid unnecessary complexities.

        C# was _NEVER_INVENTED _ that is my strategy
        until MS takes VB seriously they can lick my nuts






        On Feb 19, 4:41 pm, "rowe_newsgroup s" <rowe_em...@yah oo.comwrote:
        Now there's a question and a half Seth :)
        >
        Have you finished the preprocessor yet? :)
        >
        Finished? I haven't even started! (and probably won't)
        >
        :-)
        >
        How would you envisage it resolving something like:
        >
        <snip>
        >
        Good point Stephany, I didn't really think it through - it was just a
        thought that I had while reading this thread. Perhaps a class level
        attribute that declares the entire class contents in a certain
        language would resolve these issues, but that kind of defeats the
        purpose (not to mention the "coolness" factor) doesn't it?.
        >
        By the way, how exactly would one find how to go about writing
        something like this? Also, unless you rewrite the ide you would
        probably lose intellisense and many other special features/keywords,
        not to mention the error checking.
        >
        Thanks,
        >
        Seth Rowe
        >
        On Feb 19, 4:36 pm, "Stephany Young" <noone@localhos twrote:
        >
        >
        >
        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_em...@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:
        >"Stephany Young" <noone@localhos tschrieb:
        >
        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/>- Hide quoted text -
        >
        - Show quoted text -

        Comment

        Working...