using System;
using System.Collections;
//csc array_CopyTo_array_string_3.cs
//an elephant swalloed few bear cans
namespace stringarray_to_systemarray
{
public class SamplesArray
{
static int i = 0;
public void process(string ss)
{
string word = ss;
string[] str = word.Split(new Char [] {' ', ',', '.', ':'});
int xx =str.Length;
Console.WriteLine("Array Length " + xx);
int n1 = word.Length;
Array mysource =Array.CreateInstance( typeof(String), xx );
foreach (string s in str) {
if (s.Trim() != "")
mysource.SetValue(s,i);
i++;
//above we set the Array array values from a string array
}
//keeping some room for unknown funtion or spaces
//coming using n1 during runtime as seen with
//csc array_CopyTo_array_string.cs
Array myt =Array.CreateInstance( typeof(String), n1);
mysource.CopyTo(myt,xx);

{
Console.WriteLine(str);
}

//
abcd(myt);
}
public void abcd(Array myArr )
{
Console.WriteLine("----------------");
System.Collections.IEnumerator myEnumerator = myArr.GetEnumerator();
int i = 0;
int cols = myArr.GetLength( myArr.Rank - 1 );
string str = " ";
string str2 = "";
string sead ="";
Console.WriteLine ("---Acessed abcd---");
while ( myEnumerator.MoveNext() ){
if( i < cols ) { i++; } ;
// get the complete string
sead += myEnumerator.Current + str ;
//Console.WriteLine("---as procced after while loop--");
Console.Write( myEnumerator.Current + str );
}//end of while loop
Console.WriteLine();
Console.WriteLine("--transfered from array to a string--");
Console.WriteLine(sead);
Console.WriteLine("--TrimSatrt(nuul) to a string--");
string strim = sead.TrimStart(null);
Console.WriteLine(strim);
Console.WriteLine("Array Length: {0}", cols);
Array.Sort(myArr);
foreach (string s in myArr){ str2 += s;
str2 += (' ');
}
Console.WriteLine(str2.Trim(null));
}
}

class test
{
public static void Main() {
Console.Write("Enter a senctence : ");
string str = Console.ReadLine();
SamplesArray sa = new SamplesArray();
sa.process(str);


Console.ReadLine();
}
}
}