Home

LINQPad.Controls Event sender got null

// Winform
var button = new System.Windows.Forms.Button {
  Text = "Copy",
  Location = new Point(150, 100),
  Size = new Size(100, 30)
};

button.Click += (sender, e) => {
  //here can got button object
  var buttonSender = (sender as System.Windows.Forms.Button);    
};

// LINQPad.Controls
var button = new LINQPad.Controls.Button("Copy").Dump();
button.Click += (sender, e) => {
  // this got null
  var buttonSender = (sender as LINQPad.Controls.Button);    
};

Why transform sender to LINQPad.Controls always got null

Comments

Sign In or Register to comment.