Arrays can be passed as arguments to method parameters.
You can pass an initialized single-dimensional array to a method. In the following example, an array of strings is initialized and passed as an argument to a ShowMessagebox() method , and this method create a string with the help of elements of passed array and pop up a messagebox:
string[] strArray = { "Welcome","To","Author","Code" }; ShowMessagebox(strArray);
private void ShowMessagebox(string[] arr) { string messageStr = ""; for (int i = 0; i < arr.Length; i++) { messageStr += arr[i] + " "; } MessageBox.Show(messageStr); }