2
Answers

Why not compiling

Ask a question
Maha

Maha

11y
1k
1
It is not compiling when data type in foreach is string. It is compiling when data type in foreach is char. Problem is highlighted.

using System;

class Program
{
static void Main(string[] args)
{
string checkStr = "Address";

foreach (string c in checkStr)
Console.Write(c);

Console.ReadKey();
}
}


Answers (2)