小编sup*_*314的帖子

不同的NLog实例为了在不同的配置文件中分离NLog配置

目前,如果我将 LogManager.Configuration 指向不同的配置文件,我将面临 NLog.Configuration 覆盖问题。

是否可以在同一个项目中创建多个 NLog 实例以防止共享相同的 LogManager.Configuration?

就像是 :

FruitType 类有自己的 NLog 实例,它的 NLog.LogManager.Configuration 从默认的 nlog.config 中读取。

然后,我想将子类配置为如下所示:

Apple 类实例有自己的 NLog 实例,Apple 类 NLog.LogManager.Configuration 从 AppleNLog.config 而不是 nlog.config 读取。

然后是新水果

Orange类实例有自己的NLog实例,Orange类实例NLog.LogManager.Configuration是从OrangeNLog.config而不是nlog.config读取的。

我想这样做的原因是将 nlog 规则分离到不同的配置文件中,而不是默认的 nlog.config 来微观管理 nlog 配置。

c# configuration logging config nlog

6
推荐指数
1
解决办法
1771
查看次数

解析具有不确定数据的json

如何解析具有Assets对象的json是未知的?

{   
    "ClassName": "Excel",
    "Teacher": "Esther",
    "Student": 50,
    "Aircond": 0,
    "Assets": {
        "Chair": 50,
        "Table": 50,
        "Fan": 2,
        and might be more here and is unknown to me
    }
}
Run Code Online (Sandbox Code Playgroud)

c# json json.net deserialization json-deserialization

0
推荐指数
1
解决办法
69
查看次数