"Dynamic"-ally adding a Button

Adding a Button using "dynamic" keyword in C# 4.0 is most easy.Its like using the traditional way but dynamic types are compiled during runtime.Which makes app run more faster.



public void Click_Me(Object sender, EventArgs e)
{
   MessageBox.Show("You clicked me! Oh my God!");
}

private void Form1_Load(object sender, EventArgs e)
{
   dynamic btn = new Button();
   btn.Text = "Dont Click Me!";
   btn.Location = new Point(100, 100);
   btn.Size = new Size(100, 50);
   btn.Click += new EventHandler(Click_Me);
   this.Controls.Add(btn);
}


I can assure you using dynamic types will help your app run much more faster.And im planning to do so


Ebook Download
View all
Learn
View all
Araf Global is a software consultancy company founded in 2016 focusing on cutting edge technologies.