C#我可以访问没有全限定名的枚举 [英] C# can I access an enum without full qualified names

查看:53
本文介绍了C#我可以访问没有全限定名的枚举的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#枚举类型,该类型以非常长的限定名称结尾。例如,

I have a C# enum type that ends up with very long qualified names. e.g.

DataSet1.ContactLogTypeValues.ReminderToFollowupOverdueInvoice.

出于可读性考虑,如果我能告诉某个特定函数只使用最后一部分,那将是很好的名称,例如...

For readability, it would be nice if I could tell a particular function to just use the last portion of the name, something like...

{
    using DataSet1.ContactLogTypeValues;
    ...
    logtype = ReminderToFollowupOverdueInvoice;
    ...
}

是否可以在C#?

推荐答案

您可以使用 using 指令指定别名。它会存在于文件中的所有位置,但不是一种特定的方法。

You can use using directive to specify an alias. It will exist everywhere in the file, not in one particular method though.

这篇关于C#我可以访问没有全限定名的枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆