I have an object that I create in Form1 and then I pass that object to Form2.
Is this a good approach to modify the properties of the Form1 object instance (pois_por_punto)?
So far this is what I did:
in Form1:
public List<POI> pois_por_punto;
pois_por_punto = new List<POI>();
Then:
private void btn_editar_pois_Click(object sender, EventArgs e)
{
Form formulario = new Form2(this, pois_por_punto);
formulario.ShowDialog();
}
In Form2:
public partial class Form2: Form
{
private List<POI> _pois;
public Editar_POIs(Form1 formprincipal, List<POI> pois)
{
_pois = pois;
}
Then in my code I change the _pois properties and then I do this:
formprincipal.pois_por_punto = _pois;
}
My POI Class is like this
public class POI
{
public decimal POI_x { get; set; }
public decimal POI_y { get; set; }
public decimal POI_z { get; set; }
}