反對我有這樣數據表通過使用反射和LINQ
Name| Value
----|------
NA | VA
NB | VB
NC | VC1
NC | VC2
ND | VD1
ND | VD2
一個數據表和一類這樣
Class NVMapping {
List<string> NC { get; set; }
List<string> ND { get; set; }
string NA { get; set; }
string NB { get; set; }
}
如何使用LINQ或其他方式向數據錶轉移到這種類型的?
我想我需要在這裏強調一件事。這種映射在我的應用程序中會有很多。
不知何故,我認爲使用反射可以使這個函數是通用的,以處理所有這些有點映射。
所以如果可能的話,我寧願像通過反射來實現這個功能。
如果可能的話,將數據錶轉換成上述轉換等對象會更好。
謝謝!