I had to convert a string to int array first by splitting string by comma,then convert to int array.
and following line is working fine
int[] array = input.Split(',').Select(obj=>Convert.ToInt32(obj)).ToArray();
but i wanted to do this in different way using cast extension method.
int[] array = input.Split(',').Cast<int>().ToArray();
but using cast extension it is throwing invalid cast operation exception.
I even applied ofType() prior to cast that is not really required but still its not working.
int[] array = input.Split(',').OfType<string>().Cast<int>().ToArray();
What mistake I am making here.
I am using cast method in appropriate manner.