c# - access variable a method from another method -
i have 1 small issue variable:
public class ini { private float euhh; public void receivevalues(del ludel, int kont) { dell[kont] = ludel; euhh = dell[kont].euh; } public string pafa(int kont) { console.writeline(euhh); return euhh; } }
i want send value of dell[kont].euh (member of struct) receivevalues pafa. tried private variable euhh when print value in console value of euhh 0.
any advice please? or maybe did wrong.
you assuming calling order of 2 method. why not returning value future use:
public class ini { public float receivevalues(del ludel, int kont) { dell[kont] = ludel; return dell[kont].euh; } public string pafa(int kont, float euhh) { euhh; console.writeline(euhh); return hhh; } }
and use as:
float euhh = receivevalues(...); string s = pafa(..., euhh);
Comments
Post a Comment