what is the easiest way to access variables defined in another class
for example
now in a new classCode:public partial class Form1 : Form { public int x ; public int y ; public [,]int array = new int[10,10]; // more functions etc }
this is very simplified and i can do what i want by passing them to the function but in some cases i need to alter a lot of variables which were not created in this class. Passing them all over will not be helpful or easy to follow. i have tried a few ways but being new to OOP i was wondering if i am missing something here?Code:public class myclass() { public void addup() { x = 50; y = 100; array[0,1] = x+y; }
once again thanks in advance



LinkBack URL
About LinkBacks




If you want it public make it public. It will be more clear with a property because it is like saying "you can access this". The point being not changing anything in the Designer.cs.