- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# program to iterate over a string array with for loop
Create a string array −
string[] str = new string[] { "Videos", "Tutorials", "Tools", "InterviewQA" };
Loop until the length of the array −
for (int i = 0; i < str.Length; i++) { string res = str[i]; Console.WriteLine(res); }
Here is the complete code −
Example
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); } } }
Output
String Array... Videos Tutorials Tools InterviewQA
Advertisements