Reputation: 2543
How can I create a type in vb.net and use the type in c#? I guess I need to compile the vb project and add reference to the dll but have no idea if this is the right way to do it, or the reference will be valid. Doing this is not for fun, we have some vb code and we're considering this option.
Upvotes: 3
Views: 3833
Reputation: 1499770
Just create a Class Library project in VB, and then add a reference to that project from your C# project. (Or if it's in a different solution, add a reference to the DLL created by the VB project.) It should be absolutely fine - you'll have access to all the Public
types from your class library.
To address the comment in your question, the projects can both default to the same namespace, but it's generally a better idea to make each project have its own namespace, so it's clear where any particular type comes from.
Upvotes: 7