public static void Main() { var myObject = new MyObject(); myObject.Name = "old name"; // optionally start with a default //myObject.Inner = new MyInner(); //myObject.Inner.SomeValue = "old inner value"; Application.EnableVisualStyles(); using (Form form = new Form()) using (TextBox txtName = new TextBox()) using (TextBox txtSomeValue = new TextBox()) using (Button btnInit = new Button()) { var outer = new BindingSource { DataSource = myObject }; var inner = new BindingSource(outer, "Inner"); txtName.DataBindings.Add("Text", outer, "Name"); txtSomeValue.DataBindings.Add("Text", inner, "SomeValue"); btnInit.Text = "all change!"; btnInit.Click += delegate { myObject.Name = "new name"; var newInner = new MyInner(); newInner.SomeValue = "new inner value"; myObject.Inner = newInner; }; txtName.Dock = txtSomeValue.Dock = btnInit.Dock = DockStyle.Top; form.Controls.AddRange(new Control[] { btnInit, txtSomeValue, txtName }); Application.Run(form); } }
public static string ConvertToString(MyInner myInner) { if (myInner == null) { return(null); } return(myInner.ToString()); }
public static bool testMethod() { MyInner MI = new MyInner(); if (MI.intI == 2) { return true; } else { return false; } }
public static bool testMethod() { MyInner test = new MyInner(); if (test.intRet() == 1) { return true; } else { return false; } }
public static int Main_old() { MyInner MI = new MyInner(); if (MI.MyMeth(new MyInner2()) == 2) { return 0; } else { return 1; } }