List array modify overwrite mothod RRS feed

  • Question

  • I try to modify(overwrite) List<string>

    Here is my code

    public static List<string> configList = new List<string>();

    configList.Add("SettingA");//index=0 configList.Add("SettingB");//index=1 configList.Add("SettingC");//index=2 configList.Add("SettingD");//index=3 configList.Add("SettingE");//index=4 configList.Add("SettingF");//index=5 configList.Add("SettingG");//index=6 configList.Add("SettingH");//index=7

    //Counts are TabItems's number

    From index 0 to index 7 I can easyly call configList[i] to modify.

    But I can't modify after configList[i] I mean after index 7

    My for loop counts TabItems are user defined I may need 1 I can't just call its index to modify

    For example I have three TabIndexs in my TabControl

    And each TabItem contain lots of image

    it already load configList 8 9 10

    If I add more TabItems or remove TabItems

    Is there method I can modify or overwrite index after 7 configList


    • Edited by CY_Chen Wednesday, September 18, 2019 5:46 AM
    Tuesday, September 17, 2019 4:17 AM

All replies

  • Hi,
    please, check your "Counts". The value of "Counts" must be equal or lower than configList.Count.

    Best Regards / Viele Grüße
    Peter Fleischer (former MVP for Developer Technologies)
    Homepage, Tipps, Tricks

    Tuesday, September 17, 2019 5:18 AM