我应该如何公开枚举?
这是我的情况。
我有一个库,其中有一组我需要使用的枚举。
public enum showtype
{
comedy = 1001, horror = 1002, mystery = 1003, action = 1004;
}
我创建的另一个库正在引用该库。 我的库被多个基于控制台的应用程序引用。
我需要直接从基于控制台的应用程序分配显示类型。
Here's my situation.
I have a library that has a set of enums that I need to use.
public enum showtype
{
comedy = 1001, horror = 1002, mystery = 1003, action = 1004;
}
This library is being referenced by another library that I created.
My library is referenced by more than one console based app.
I need to assign the show type directly from the console based app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一些附加说明可澄清可能发生的情况:
如果您的应用程序引用的库使用
enum
引用该库,那么这还不够。您需要使用enum
直接引用该库。您还应该确保使用
using
构造打开enum
所在的命名空间。A few additional notes to clarify what may be going on:
If your application references a library that references the library with the
enum
, then this is not enough. You need to directly reference the library with theenum
.You should also make sure that you open the namespace where the
enum
is located using theusing
construct.这应该很简单。添加对包含控制台应用程序中的枚举的库的引用。
It should be pretty simple. Add a reference to the library that contains the Enum inside your console application.
你的枚举已经暴露了。添加参考,您就可以开始了。
Your enum is already exposed. Add the reference and you're ready to go.