C# String to Character Array Conversion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StringtoCharArray
{
class Program
{
static void Main(string[] args)
{
string s;
Console.WriteLine("enter string:");
s = Console.ReadLine();
Console.WriteLine(s);
char[] ch = new char[s.Length];
ch = s.ToCharArray();
for (int i = 0; i < s.Length; i++)
{
Console.WriteLine(ch[i]);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StringtoCharArray
{
class Program
{
static void Main(string[] args)
{
string s;
Console.WriteLine("enter string:");
s = Console.ReadLine();
Console.WriteLine(s);
char[] ch = new char[s.Length];
ch = s.ToCharArray();
for (int i = 0; i < s.Length; i++)
{
Console.WriteLine(ch[i]);
}
}
}
}
OUTPUT : To See the Output Run the Console Application
Sign up here with your email
ConversionConversion EmoticonEmoticon