My Visual Studio 2008 solution contains both C# and VB.NET projects. From a VB.NET project, how can I access a C# property with its access modifier set to "internal"?
views:
161answers:
1
+7
A:
You need to make the assembly's friends with the InternalsVisibleTo attribute.
Assuming that you don't sign your assemblies, it's as easy as adding an assembly level InternalsVisibleTo attribute to the C# project with the name of the VB.Net assembly. Typically you do this in AssemblyInfo.cs (under the Properties folder)
[assembly:InternalsVisibleTo("MyVbAssemblyName")]
JaredPar
2009-09-24 18:36:46
+1 beat me to it.
klabranche
2009-09-24 18:37:37
Here's an SO link discussing this: http://stackoverflow.com/questions/171332/accessing-internal-members-via-system-reflection
klabranche
2009-09-24 18:38:12
Thanks. Works great between C# and VB.NET. It looks like there's no good way to make my C# internals visible to ASP.NET though. That's not a huge problem for me though.
Slack
2009-09-24 19:12:17