C# novice here.
I was under the impression that when a method is called, the value on the parameters go one way ONLY i.e from the method call to the method itself.
callResturant(name) //function call with string variable "name" passed to the method.
in this case can callResturant send a value back to the method call from the parameter? I know that the method can RETURN a value to the call but is it also possible for it to send a value back from the parameter also? I ask because on the following example, it seems that the method is returning values from the parameter to the call.
Notice the method display movie is void but it is able to send values back to the call from its parameter. You will have to create a file name movie.txt and place it where the debug folder of wherever you are running c# from. Also enter a string value and on the next line enter an integer, and repeat the process until about 10 lines are completed. I entered Pizza and on the next line 5, Sub and the next line 3 so on ..
Any advice would be appreciated.
static void Main(string args)
string MovieName = new string;
int StarRating = new int;
for (int i = 0; i < MovieName.Length; i++)
public static void DisplayMovie(string name, int star)
StreamReader inData = File.OpenText("movie.txt");
for (int i = 0; i < name.Length; i++)
name[i] = inData.ReadLine();
star[i] = Convert.ToInt32(inData.ReadLine());