Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Method's parameter equals with class variable

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;
        public static int text2;
        public double result(double text1, double text2, bool quotients, bool products,bool difference,bool sum)
        {
           [...]
        }

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 .🤝
Code
public static int text1;
public static int text2;
public double result(double text1, double text2, bool quotients, bool products,bool difference,bool sum)
{
this.text1 = text1;
this.text2 = text2;

[...do action with static variables]
}
do you mean something like this?
yeah but , this is valid only in the method and not on external classes , isn't it ?
public static int text1 { get; private set; }
public static int text2 { get; private set; }

Makes the public (readonly) properties.
ClassName.text1 = ...
ClassName.text2 = ...

You know how static works ?
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
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


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SIM-5195853Jun 6, 2022 10:54 AM 4 168 Jun 6, 2022 10:54 AM
Last Post: HFDone
[C] by lockheadApr 22, 2021 07:10 AM 0 147 Apr 22, 2021 07:10 AM
Last Post: lockhead
[C#] by Lor‌dJul 7, 2020 12:52 PM 19 399 Jul 7, 2020 12:52 PM
Last Post: n0$f3ratu$