I have a legacy VB.Net class library that includes some extension methods, one of which is roughly this:
Namespace Extensions
Public Module OrmExtensions
<Extension()>
Public Function ToDomainObjectCollection(ByRef objects As OrmCollection(Of OrmObject)) As DomainObjectCollection
Return objects.AsQueryable().ToDomainObjectCollection()
End Function
<Extension()>
Public Function ToDomainObjectCollection(ByRef objects As IQueryable(Of OrmObject)) As DomainObjectCollection
Dim doc As New DomainObjectCollection()
For Each o In objects
doc.Add(o.ToDomainObject())
Next
Return doc
End Function
End Module
End Namespace
To use these extensions in VB I just have to import Extensions.OrmExtensions. I have another project, which is in C# that depends on the VB one with the extensions and I can't get them to work. OrmExtensions isn't available and simply using the namespace VBProject.Extensions doesn't make the extensions available.
There are multiple projects that depend on the VB project and ideally the extensions should be available to all of them.
I've done a fair bit of googling but haven't been able to turn up anything about actually using VB extension methods in C#. I assume the issue is that they're required to be in a Module, but I haven't been able to confirm that.
I'd rather not duplicate the extension methods everywhere they're required(especially in our unit test project, which is in C#).
IEnumerable<T>, notIQueryable<T>.OrmExtensions.and look for the methods? How do they appear? Do they look like valid extension methods?