0

I've been using VB.Net for the last couple of years and am now switching over to C#. I have a few DLLs of projects which have been written in VB.Net that I'd like to import to my new C# solution. I've referenced the DLLs but when I import with the 'using' keyword some features don't work as expected. I can use functions as I normally would but extension methods are not recognised.

I have read that in C# you can only import namespaces whereas in VB.Net you can import classes so I wonder if this is the issue as the VB.Net code is not namespaced.

Is there any way around this without having to go through and namespace the VB.Net class library (not really viable currently).

EDIT: My extensions methods are in a VB.Net Public Module.

Thanks, Andy

2
  • 1
    Your VB.NET class is in a namespace...if you haven't added any additional namespaces, then it's just the root namespace.
    – rory.ap
    Commented Feb 1, 2015 at 14:33
  • @roryap: A VB.NET project does not require a root namespace, so it is perfectly valid to have a VB.NET class that does not exist in any namespace. Commented Feb 1, 2015 at 16:11

1 Answer 1

2
  1. Make sure your VB modules are Public.
  2. Reference the VB class library's namespace (there is one even you haven't set it manually) from the C#'s code module with using.

Not the answer you're looking for? Browse other questions tagged or ask your own question.