c# - 命名空间范围

标签 c# namespaces

我有一个名为 AuditLog 的类(class)内Domain.AuditLog命名空间。我想用AuditLog具有命名空间的另一个类中的类 ApplicationServices.AuditLog .喜欢:

using Domain.AuditLog;
namespace ApplicationServices.AuditLog
{
    public interface IAuditLogService
    {
       List<AuditLog> GetAuditLogs();
    }
}

它说“ApplicationServices.AuditLog”是一个“命名空间”,但像“类型”一样使用。我知道我可以使用以下方法解决这个问题:
namespace ApplicationServices.AuditLog
{
    using Domain.AuditLog;
    public interface IAuditLogService
   {
       List<AuditLog> GetAuditLogs();
   }
}

是否有另一种引用方式 Domain.AuditLog ?

最佳答案

也许这可以帮助你:

using AL =  Domain.AuditLog.AuditLog;
namespace ApplicationServices.AuditLog
{
    public interface IAuditLogService
    {
       List<AL> GetAuditLogs();
    }
}

关于c# - 命名空间范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28413516/

相关文章:

C# 使用 Missing.Value 和只从方法调用中省略可选参数之间的区别?

c# - 如何使用 Html.RenderAction 实现 ModelBinding?

macos - OS X 10.5 SDK 已弃用 getAttributeNS;我应该使用什么?

docker - 从特权容器输入主机命名空间

c# - EPPlus 中的自动列宽

c# 将小数转换为逗号分隔的字符串

c# - emgucv 3.1 无法识别 CvBox2D

php - 如何在 TCPDF 中使用命名空间?

php - 无法从 PHP 中的命名空间类调用全局类。使用 Composer 自动加载

php - 如何在php中使用带有命名空间的类?