下面是示例代码
public People{
public int Age{get;set;}
public string Name{get;set;}
public string Address{get;set;}
}
public PeopleDto{
public int Age{get;set;}
public string Name{get;set;}
public string Address{get;set;}
}
现在,我想MapAge
和Name
字段,而Address
字段保留默认值,我想使用如下函数:
var config= TypeAdapterConfig.GlobalSettings.Default.Config.Clone();
config
.ForType<People, PeopleDto>()
.IncludeFields(src=>src.Age,src=>src.Name)//This method does not currently exist, here is just an example
.MaxDepth(2);
可以这样做吗?
我检索了相关信息,但未找到任何可用信息。
1条答案
按热度按时间dw1jzc5e1#
已经修好了