give me sample example code for passing array data to other function
-
hi, plz help i want to send array(string data ) data to other function how can i send that data plz give me sample code for that
-
hi, plz help i want to send array(string data ) data to other function how can i send that data plz give me sample code for that
-
public void DoSomething(string[] values) {
foreach (string value in values) {
Console.WriteLine(value);
}
}DoSomething(new string[] { "A text line.", "Another line." });
--- b { font-weight: normal; }
-
What is it that you don't understand? It's a method that accepts an array of strings as parameter, and it's a call to the method that creates an array of strings.
--- b { font-weight: normal; }
-
public void DoSomething(string[] values) {
foreach (string value in values) {
Console.WriteLine(value);
}
}DoSomething(new string[] { "A text line.", "Another line." });
--- b { font-weight: normal; }
hi i have one array in one function . that array i want send other function. how can i send that array plz modify the code i am new to programming. in runtime iam getting that array . DoSomething(new string[] { "A text line.", "Another line." });
Hi, Thanks, if u think it's good. otherwise sorry.
-
hi i have one array in one function . that array i want send other function. how can i send that array plz modify the code i am new to programming. in runtime iam getting that array . DoSomething(new string[] { "A text line.", "Another line." });
Hi, Thanks, if u think it's good. otherwise sorry.
premkamalg wrote:
DoSomething(new string[] { "A text line.", "Another line." });
this is just a different way to declare and initialize a string. you could reach the same thing this way: string[] strArr = new string[2]; string[0] = "a text line"; string[1] = "another line"; DoSomething(strArr); clear now?