Search code examples
c#dllexport

How do you limit what gets exported from a c# dll?


I have a dll that I only want certain classes to be exported. In C++, you can use the class __declspec(dllexport) ClassName ... Is there a C# equivalent?


Solution

  • Mark the types/members that you want to be externally available as public, and the things you don't want to export as either internal, or (where available - members and nested types) private. If unspecified, top-level classes default to internal, and methods default to private.