简体   繁体   中英

Why same dll exposes different classes in C# and .net

I am using a third party .Net dll in my code and when I add a reference to this dll from a VB.Net application it shows different classes in intellisense and object browser than when I use it in a C# project. Why is there this difference?

Edit

If designer intended it that way I'd like to know how to do it in my own dlls.

Without knowing the specifics, it is hard to say. Some possibilities that come to mind are:

  • The designer made it that way on purpose
  • Parts of the library are not CLR compliant, and therefore not visible by languages other than the one it was written in.

VB.NET provides the option to "hide advanced members". Perhaps it's the "advanced" members you're not seeing.

One thing to remember here is that intellisense is an approximation of what's allowed and legal in the program. It's goal is to be very close to true but often isn't. There are several reasons why a particular type may or may not show up in intellisense but does in C#

  • One of the 2 projects may be friends with the target assembly
  • Intellisense filters may exist on the documentation files which hide them from intellisense
  • Attribute filters on the type
  • Certain classes may get hidden due to case only differences in the name

Given that it also doesn't show up in the object browser, my guess is that the class has either intellisense or attribute filters that cause it to be hidden for VB.Net.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM