I have two different properties and hence two values. These properties are read and write properties. I have one method and I need to pass both property values to this one method. How to I accomplish this? Is using Array the only way to do this?
Here is example:
In a Calculator example:
//Property 1
public int numberone
{
get { return passnumberone; }
set { passnumberone = Add(value);}
}
//Property 2
public int numbertwo
{
get { return passnumbertwo; }
set { passnumbertwo = Add(value);}
}
//Method
private int Add(?)
{
int numberone
int numbertwo
int finalanswer
finalanswer = numberone + numbertwo
return finalanswer;
}
//Calling
Calculator.numberone = 10;
Calculator.numbertwo = 12;
I know I could use the method only and pass these two number very easily. But I am trying to use the porperties.
Thanks in Advance!
You will have to pass the object that contains the properties to the method if the object is not the same as the one that contains the Add method.