0
我硬編碼,我肯定可以更巧妙地做了的所有成員 - 有趣的小問題 - 使用C#6.0CONCAT類
如何減少這一點 - 它會在另一個20線。
string fullLine = newLine.col1_index_no +
newLine.col2_depot_custRef +
newLine.col3_depot_no +
newLine.col4_driver_id +
newLine.col5_vehicle_id +
newLine.col6_trans_type;
如果它幫助這裏是類:
class lineBuilder
{
public string col1_index_no { get; set; }
public string col2_depot_custRef { get; set; }
public string col3_depot_no { get; set; }
public string col4_driver_id { get; set; }
public string col5_vehicle_id { get; set; }
public string col6_trans_type { get; set; }
public string col7_sign_id { get; set; }
public string col8_note_id { get; set; }
public string col9_route_code { get; set; }
public string col10_RA_no { get; set; }
public string col11_doc_type { get; set; }
public string col12_user_gen_flag { get; set; }
public string col13_seq_no { get; set; }
public string col14_pallet_id { get; set; }
public string col15_tote_id { get; set; }
public string col16_adj_type { get; set; }
public string col17_rtn_sig_not_avlb { get; set; }
public string col18_scan_dateTime { get; set; }
public string col19_scan_in_time { get; set; }
public string col20_AX_status { get; set; }
}
您可以使用反射並遍歷屬性來獲取它們的值並創建字符串。訣竅在於得到你想要的訂單 – Nkosi