How to publicly expose an enum from a class library

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

It is possible to expose an enumerated type from within a class library so
that other projects referencing that class library will see it in the
class's namespace? For example, if I have a class library called "foo"
which has a public enumerated type called "bar" declared in a module of that
class library, is it possible for a different project referencing "foo" to
be able to declare variables of type "foo.bar"?

- Don
 
Don said:
It is possible to expose an enumerated type from within a class
library so that other projects referencing that class library will
see it in the class's namespace? For example, if I have a class
library called "foo" which has a public enumerated type called "bar"
declared in a module of that class library, is it possible for a
different project referencing "foo" to be able to declare variables
of type "foo.bar"?

You don't have to put it in a module (but of course you can). If you declare
the Enum Public, there should be no problem. If you put it in a module or a
class, the module/class must also be public.
 
Okay, that's what the problem was. I had put it in a module, but had not
delcared the module as public. Thanks.

- Don
 
* "Don said:
It is possible to expose an enumerated type from within a class library so
that other projects referencing that class library will see it in the
class's namespace? For example, if I have a class library called "foo"
which has a public enumerated type called "bar" declared in a module of that
class library, is it possible for a different project referencing "foo" to
be able to declare variables of type "foo.bar"?

Just declare the enum directly in the namespace (not within a module or
class).
 
I didn't know you could do that. That is preferable to either method and
feels more "correct".

- Don
 
Back
Top