如果您希望有兩個(gè)不同類型的 KeyValue DTO(有時(shí)是 'int' 類型,有時(shí)是 'string' 類型),那么最佳實(shí)踐是什么。有兩個(gè)這樣的 DTO 是不是更好:public class KeyValueDto { public int Key { get; set; } public object Value { get; set; } }public class KeyValueDto { public string Key { get; set; } public object Value { get; set; } }或者有一個(gè) DTO:public class KeyValueDto { public object Key { get; set; } public object Value { get; set; } }考慮鑄造操作的成本在哪里使用DTO?
針對(duì)不同用途使用 KeyValue DTO 的最佳實(shí)踐是什么
天涯盡頭無(wú)女友
2023-08-20 15:56:39
