7
La conversion de tableau co-variant de x à y peut provoquer une exception d'exécution
J'ai une private readonlyliste de LinkLabels ( IList<LinkLabel>). J'ajoute plus tard des LinkLabels à cette liste et ajoute ces étiquettes à un FlowLayoutPanelcomme suit: foreach(var s in strings) { _list.Add(new LinkLabel{Text=s}); } flPanel.Controls.AddRange(_list.ToArray()); ReSharper me montre un avertissement: de Co-variant array conversion from LinkLabel[] to Control[] can cause run-time exception …
142
c#
winforms
.net-4.0
covariance