I wrote some string extension methods in a VB assembly and am unit testing them from a C# project. However, C# acts like it cannot see the the extension methods, when other VB projects reference the VB assembly they have no problem. Both the VB assemebly and the C# test project are targeting .Net 3.5.
Is there a way around this?
VB.Net extension methods:
Imports System.Runtime.CompilerServices
Imports System.Text.RegularExpressions
Imports System.Linq
Namespace ExtensionMethods
Module StringExtensions
<Extension()> _
Public Function Remove( _
ByVal input As String, _
ByVal subStrings As String()) As String
...
End Function
<Extension()> _
Public Function Substrings( _
ByVal input As String, _
ByVal regexPattern As String, _
ByVal regexOptions As RegexOptions) As IEnumerable(Of String)
...
End Function
<Extension()> _
Public Function Substrings( _
ByVal input As String, _
ByVal regexPattern As String) As IEnumerable(Of String)
...
End Function
End Module
End Namespace
VB.Net usage:
Imports SomeNamespace.ExtensionMethods
...
someString = someString.Remove(subStringsToRemove)
C# usage (doesn’t work):
using SomeNamespace.ExtensionMethods; //No error, but ExtensionMethods is not in the intellisense
...
someString = someString.Remove(subStringsToRemove); //error, can't find matching overlaod
Tried to make the module ‘Public’?
Update:
Can’t explain why it worked with other VB assemblies. Think that C# has its own vision of class access modifiers or something.