![]() |
|
[C#] Method's parameter equals with class variable - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Method's parameter equals with class variable (/showthread.php?tid=4312518) |
Method's parameter equals with class variable - vitaminic - Jun 29, 2014 Hello beautiful forum once again . I was trying to make a class static variable equal with a method's parameter but I (apparently) don't know how to do it . This code : Code public static int text1;I want to make these static integers to call them from one another class which will be the project which has this class as a reference library , and because I can not call a single parameter from another method or class , I have to make these static variable which will be equal with these parameters . I am telling you these stuff hopefully that if I can not do something with the way I thought I could , you would tell me another way to do it .🤝 * - DisguiserNET - Jun 29, 2014 Code public static int text1;* - vitaminic - Jun 29, 2014 yeah but , this is valid only in the method and not on external classes , isn't it ? * - TreeTopSky - Jun 29, 2014 public static int text1 { get; private set; } public static int text2 { get; private set; } Makes the public (readonly) properties. * - 0xDEAD10CC - Jun 29, 2014 ClassName.text1 = ... ClassName.text2 = ... You know how static works ? * - vitaminic - Jun 29, 2014 thank you buddy :D The properties and you too saved me ... I just do not undestand how properties work exactly , it reminds me kinda (don't know if it is correct) functions . For instance : "get" keyword is "f(x) =" and "set" is the equality f.e. [get "f(x)"] = set(ax * b) ... is this a good representation of the get set or not ? Thank you dude ... :D |