protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); power = new Power (3); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button> (Resource.Id.MyButton); button.Click += delegate { var number = power.Compute (count++); button.Text = string.Format ("{0} is the power", number); }; }
static void Main(string[] args) { var power = new Power (5); var number = power.Compute (5); Console.WriteLine (number); }
// Shared initialization code void Initialize() { power = new Power (8); }
public override void ViewDidLoad() { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. power = new Power (4); }