using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = "Hello World!";
for (int i=0; i<input.Length; i++)
{
// Get the integral value of the character.
Console.WriteLine("Letter is {0}", input[i]);
}
// to avoid automatic console close
Console.ReadLine();
}
}
}
on peut aussi
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = "Hello World!";
foreach (char letter in input)
{
// Get the integral value of the character.
Console.WriteLine("Letter is {0}", letter);
}
// to avoid automatic console close
Console.ReadLine();
}
}
}