根據我的其他問題:
我得到了一個串列和一個選定的索引,我將其序列化:
我得到了一個串列和一個選定的索引。
public interface IControlListManager
{
List<ControlListManager.TargetSettings> TargetList { get; set; }
int SelectedIndex { get; set; }
在designer.cs中,我得到了以下的序列化代碼:
在designer.cs中,我得到了以下的序列化代碼。
/.../span>
controlListManager1.SelectedIndex = 0;
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this, "" /span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.InfoPanel, "" , DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.InfoText, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.HLine, "", DisplayModes。 FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.LogiDevType, "" , DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.LogiDevSetBtn, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.SystrayContextMenu, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.restoreToolStripMenuItem, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.exitToolStripMenuItem, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.panel1, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.IdentifierInput, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.ExitButton, "" , DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.IdentifierCheckbox, ""/span>, DisplayModes. FollowXY, true, 0, 0, 0)。)
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.SaveLogFile, "" , DisplayModes. FollowXY, true, 0, 0, 0))。)
//...。
問題是,SelectedIndex應該在串列之后,因為它代表了串列的索引。
我怎樣才能告訴設計者把它放在串列之后呢?
uj5u.com熱心網友回復:
因為我不想亂用BeginInit()和EndInit()方法(我真的應該這樣做),并且發現,這確實是事實,序列化器的順序是按字母順序排列的。
我將SelectedIndex重命名為ZSelectedIndex。有趣和骯臟 - 但快速的解決方案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/317268.html
標籤:
上一篇:VisualStudio中通過Kestrel(不是IISExpress)托管的Blazor服務器能否支持在Razor檔案改變時自動重建?
