One example is described on following below
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] StringArray = Cast(GetStringArray(), new { MyList = new string[] { } }).MyList;
foreach (string item in StringArray)
{
Console.WriteLine(item);
}
Console.ReadLine();
}
static object GetStringArray()
{
return new { MyList = new string[] { "Code", "Project", "Question", "Answer" } };
}
static T Cast<T>(object obj, T Type)
{
return (T)obj;
}
}
}