0

i want get multiple values if i call i method.

example:

_____________________________________________
public void setData(int age, string name, string address){}

______________________________________________
Data data = new Data();
data.setData(age, name, address);
______________________________________________

when setData() are excuted he doesn't return the parameters with the values.

what can i do?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by tchiloh
0

In your setData you could simply change public properties and then access it from the other class.

public class Data
{
private int _age = 0;
public int Age { get { return _age; } set { _age = value; } }

public void setData(int age, string name, string address)
{
//ill just do age for the example
     _age = age;
}
}

in your other class (mainform for example)

//in some method
Data d = new Data();
data.setData(age, name, address);

//after you can access or change with
int temp = data.Age;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.