एक स्ट्रिंग ऐरे बनाएं -
string[] str = new string[] {
"Videos",
"Tutorials",
"Tools",
"InterviewQA"
}; सरणी की लंबाई तक लूप करें -
for (int i = 0; i < str.Length; i++) {
string res = str[i];
Console.WriteLine(res);
} यहाँ पूरा कोड है -
उदाहरण
using System;
public class Demo {
public static void Main() {
string[] str = new string[] {
"Videos",
"Tutorials",
"Tools",
"InterviewQA"
};
Console.WriteLine("String Array...");
for (int i = 0; i < str.Length; i++) {
string res = str[i];
Console.WriteLine(res);
}
}
} आउटपुट
String Array... Videos Tutorials Tools InterviewQA