How to use C# class in VB.NET project in windows application?

后端 未结 4 1015
逝去的感伤
逝去的感伤 2020-12-20 15:18

I wanna use the C# code file in VB.Net project Which is windows based application. But that C# class is not using in VB.NET application. How Can I perform this task.

4条回答
  •  無奈伤痛
    2020-12-20 15:23

    It is possible, check this: http://bytes.com/topic/net/answers/49259-mixing-vb-net-c-same-project

    However, it is possible to use different languages in a single project. You may need to write command line build file to build the project. In .NET framework SDK, there is one sample on it. You could access it in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Technologies\CrossDevLan guage.

    This sample demonstrates the use different development languages in a single project. This sample creates two assemblies. The first is a library or DLL assembly that defines a simple base class written in managed extensions for C++. The second assembly is an executable assembly that defines three derived classes written in C#, VB, and IL (Intermediate Language). These types derive from each other and ultimately from the base class written in managed C++. Finally, the executable creates instances of each of the derived types and calls a virtual method for each. The .NET Framework is an environment where various developers can work together seamlessly while developing in their language of choice.

提交回复
热议问题