我有一個列表,並希望在列表填充後添加兩個新屬性。將一個新的屬性添加到列表
可以這樣做嗎?
C#列表
List<Usp_GetListItemsBySystemResult> PendingListOfItemsToControl = new List<Usp_GetListItemsBySystemResult>(); // Items to Control in Running memory
// Get items to Control into running memory
FAItemsUnderControl fItemsUnderControl = new FAItemsUnderControl(ConfigurationManager.AppSettings["DatabaseConnectionString"]);
PendingListOfItemsToControl = fItemsUnderControl.getItemsUnderControl(DropDownListSystems.Text.ToString(), "ALL").ToList<Usp_GetListItemsBySystemResult>();
// Add new paramaters to the list here ????????
C#新的屬性添加
public string ItemRequestStatus { get; set; } // Determines the change status if applicable
public bool IsButtonEnabled { get; set; } // Determines if the delete button is enabled or disabled
C#類
public class Usp_GetListItemsBySystemResult
{
public Usp_GetListItemsBySystemResult();
public DateTime? Creation_DateTime { get; set; }
public string Item_Backup_Location { get; set; }
public string Item_Category { get; set; }
public short? Item_Check_Interval_Time { get; set; }
public DateTime? Item_Creation_DateTime { get; set; }
public DateTime? Item_Last_Access_DateTime { get; set; }
public DateTime? Item_Last_Modified_DateTime { get; set; }
public string Item_Name { get; set; }
public string Item_Path { get; set; }
public int? Item_Size { get; set; }
public string Item_Status { get; set; }
public string Item_Value { get; set; }
public string Item_Value_SHA256 { get; set; }
public int? ItemUnderControl_ID { get; set; }
}
這可能是一個語言的事情,但你的問題沒有任何意義。 'List's沒有「參數」,所以我不明白你想要完成什麼。 – CodingGorilla
現在更新了這個問題。謝謝 – user1438082
作爲班級的一部分,你是否需要屬性作爲列表的一部分? – Oded