Życzę wszystkim aby spędzili Święta w taki sposób w jaki sobie wymarzą i z tymi ludźmi, przy których będą czuli się najlepiej.
Serdecznie pozdrawiam
Michał Komorowski
Serdecznie pozdrawiam
Michał Komorowski
The blog about programming, working in IT and not only
delegate void Fun(); ... Listarray = new List (); for (int i = 0; i < 5; ++i) { array.Add(delegate() { Console.WriteLine(i); }); } for (int i = 0; i < 5; ++i) { array[i](); }
[CompilerGenerated]
private sealed class DisplayClass
{
public int i;
public void b_0()
{
Console.WriteLine(this.i);
}
}
DisplayClass d = new DisplayClass(); Listarray = new List (); for (d.i = 0; d.i < 5; ++d.i) { array.Add(d.b_0); } for (int i = 0; i < 5; ++i) { array[i](); }
for (int i = 0; i < 5; ++i)
{
int j = i;
array.Add(delegate() { Console.WriteLine(j); });
}
...
ListBox lb = new ListBox();
lb.AutoPostBack = true;
lb.SelectedIndexChanged += new EventHandler(lb_SelectedIndexChanged);
lb.Items.Add("a");
lb.Items.Add("b");
lb.Items.Add("c");
this.Panel.Controls.Add(lb);
...
...
this.DataList.DataSource = new string[] { "a", "b", "c" };
this.DataList.DataBind();
...
...
<asp:DataList ID="DataList" runat="server" EnableViewState="false">
<ItemTemplate>
<asp:Button ID="Button" runat="server" Text="<%# Container.DataItem %>" OnClick="OnClick" />
</ItemTemplate>
</asp:DataList>
...
...
<head runat="server">
<link id="link"
type="text/css"
rel="Stylesheet"
href="~/style.css"
runat="server" />
</head>
...
this.link.Visible = false;to nie zostanie wzięta pod uwagę podczas renderowania strony i styl nie zostanie zastosowany do strony. Odwrotnie, jeśli kontrolka będzie widoczna:
this.link.Visible = true;to podczas renderowania strony zostanie uwzględniona i styl zostanie zastosowany do strony. Bardzo proste ale skuteczne.